News for hackers. Stuff that matters.
Re:Sshole by __MatrixMan__ on Thursday November 05, 2026 @09:35AM (#50379589)
PSA: you can typically declare different types of string so that your type system objects to mixing data of different types even though deep down we know they're both strings.
Re:Sshole by BoppreH on Thursday November 05, 2026 @10:28AM (#50380315)
If you mean type aliases, that's a good idea within a single codebase, but the distinction between different types of strings doesn't survive serialization so it wouldn't have prevented this error. They really needed to return either null or a structure that includes a tag indicating success or failure (aka Result<T>).
Re:Sshole by __MatrixMan__ on Thursday November 05, 2026 @10:34AM (#50380427)
At least in python there's a difference between type aliases and typing.NewType (the difference described here: https://gist.github.com/simonwhitaker/3a24d669b26b4f373690c6...)

That's what I was thinking of. I assume something similar exists in other languages.

Re:Sshole by __MatrixMan__ on Thursday November 05, 2026 @11:07AM (#50380881)
In python, aliases are separate from typing.NewType, but you're right: it's only enforced within a codebase and then only if the dev cares to run the typechecker.

So yeah, I guess it either needs to happen at runtime, or we just do signaling and user data on separate file descriptors.

Re:Sshole by Normal_gaussian on Thursday November 05, 2026 @11:47AM (#50381343)
This is presuming that the type system is nomitive rather than structural and there is not serialisation/deserialisation or type refinement occurring. A structural difference is much more preferable.