Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
codebje
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
7 ms
·
271.
▲
by
codebje
3y ago
Perhaps the more reasonable/descriptive way to represent the potentially no-value result of the computation is with a sum type, not a union type?
272.
▲
by
codebje
3y ago
Consider an expensive computation that may have no answer, and so it returns (after some heavy processing) "int|None". Also consider a cache lookup function that takes some key and returns a generic T|None for T the type of cache
273.
▲
by
codebje
3y ago
That's not quite what the parent is trying to say. Assume that int is not None. Create a type called T that is int|None - a term of type T can be an int, or it can be None. Now have a function whose argument is T|None. Substitute in th
274.
▲
by
codebje
3y ago
Transferring costs from compile time to runtime is pretty much the signature move of dynamic languages. If you already carry around type information and check it at runtime, why not just add union types? Your implicit conversion is zero cos
275.
▲
by
codebje
3y ago
Isn't that an argument that the function implementation might break, not that callers might? Assuming implicit conversion for union types, you could either widen argument or narrow return without changing that implementation, but not b
276.
▲
by
codebje
3y ago
Somewhat related. The subclass relationship isn't very rigorous, you're free to have completely different behaviours out of the same methods in a subclass. Liskov says don't do that: if B is a subclass of A it should behave l
277.
▲
by
codebje
3y ago
The hash key is only an index, and the same input always gives the same hash value, so you can retrieve your item just fine even if you can't recover the original key from the hashed value. A hash _map_ is not a hash _function_.
278.
▲
by
codebje
3y ago
Technically the identity function on 64-bit integers is a hash function. There's just not much you can say about hash functions in general.
279.
▲
by
codebje
3y ago
You can't really say much in general about hash functions - they're just general functions. The more you try to infer additional rules about hash functions, the more use cases you start to exclude. For example, _mostly_ hash funct
280.
▲
by
codebje
3y ago
Sure - once the hallucination problem is solved. Otherwise it'll just tell you the guy's name is Harry whether that's supported by the data available or not.
281.
▲
by
codebje
3y ago
The OS is the fully trusted client - but you can't repeat that trick for a web app running on a remote server.
282.
▲
by
codebje
3y ago
https://datatracker.ietf.org/doc/rfc7591/ The only reason an authorisation server would support dynamic client registration, however, is because it's meant to be pluggable as the back-end for an API integrati
283.
▲
by
codebje
3y ago
There's a single URL for OIDC IdPs too. It's not supported in every web app for the same reason SAML isn't: it's a two-way exchange to set up, not a one-way exchange. In OIDC (OAuth 2) you need to register a client first
284.
▲
by
codebje
3y ago
Dynamic client registration is standardised ( https://www.rfc-editor.org/rfc/rfc7591.html ), the authorization code flow is standardised ( https://www.rfc-editor.org/rfc/rfc6749.html ). The device aut
285.
▲
by
codebje
3y ago
Kerberos just doesn't solve the same problem: it starts by giving your username and password to a fully trusted client. OAuth was invented to avoid the need to do that. If I use some finance package and I'd like it to download my
286.
▲
by
codebje
3y ago
One I could think of is you could use accelerometer data to know if the phone is moving, and how: is it just being lifted and interacted with, is the user walking or running, are they in a car. For a high profile target you might also be ab
287.
▲
by
codebje
3y ago
It'd be a missed opportunity if someone with a talking dog tried to hype it as a replacement for C++ programmers instead of an entertaining sideshow - no-one wants a talking dog that writes terrible C++ code to be writing their C++ cod
288.
▲
by
codebje
3y ago
Star Wars is pretty dystopian in every era shown in the movies. Even at the height of the Galactic Republic large areas of the outer rim have people living in poverty and outright slavery. Coruscant appears nice, but a little below the surf
289.
▲
by
codebje
3y ago
You've seen the scope output for bounces: the signal will often go completely from one extreme to the other, as well as a little bit of noise just after a change. A switch might bounce a hundred times, rail to rail, taking 5ms or more
290.
▲
by
codebje
3y ago
That place has nice beer, but no atmosphere.
291.
▲
by
codebje
3y ago
> Could our computers handle it? It's been a very long time since computers were anything other than binary, and unless quantum computing takes a, haha, quantum leap forward it will be a very long time yet until they're doing a
292.
▲
by
codebje
3y ago
Lua is super common because it's super easy to embed into a C(++) project.
293.
▲
by
codebje
4y ago
XMPP (née Jabber) isn't a broadcast messaging platform like Twitter or Mastodon, it's a one-on-one or small group instant messaging protocol. It absolutely failed to take off as a broadly decentralised instant messaging service, f
294.
▲
by
codebje
4y ago
That's a great example of knowing exactly what ??? means: the program is misbehaving and should terminate. It's dead in the current call stack, but over time programs change and that is how errors creep in. If it's a precondi
295.
▲
by
codebje
4y ago
If you don't know what ??? should be, your code's going to misbehave in production - at best crashing, at worst causing data corruption or an exploitable vulnerability. If "???" is just "foo = INT_MIN;" clang w
296.
▲
by
codebje
4y ago
> I have noticed this when trying to get it to generate some code, it was clearly using considerably old versions. I have noticed the same thing when trying to use junior devs to generate some code, usually correlating with how old the m
297.
▲
by
codebje
4y ago
I have been on and off writing an emulator for the eZ80 CPU. This CPU has two addressing modes, Z80 mode in which it's effectively an 8-bit processor with a 16-bit address space, and ADL (Address Data Long) mode in which it has a 24-bi
298.
▲
by
codebje
4y ago
The only thing that got hacked to pieces more than the English peasantry during the middle ages was the English language.
299.
▲
by
codebje
4y ago
It only took 200 years for 200 of those 260 languages to be lost or brought to the edge of extinction. It's at least plausible and to me quite believable that the arrival of a group with a technological advantage 4,000 years ago could
300.
▲
by
codebje
4y ago
It looks pretty typical for BASIC of the late 70s to me. You wouldn't want to waste characters on commenting code: machines of that era would have only a few KB of RAM, as low as 1K. For the same reason you don't want to waste cha
More ›