Re:LemonScript: A typed programming language inspired by Typ...
by karmakaze on Friday November 26, 2021 @10:47PM
(#29357198)
Notably absent (at least in the docs) is a Hash/Map datatype, a struct type may be beyond the goals of the language. I do see how it straddles Python and TypeScript in character. One thing I miss from TypeScript is the Union/Sum type which is far underutilized in languages.
[ Parent
| on HN ]
Re:LemonScript: A typed programming language inspired by Typ...
by maweki on Saturday November 27, 2021 @02:51AM
(#29358406)
Proper union types are really hard if you want to do anything more than check. Once you're into inference territory, this gets really hard.
Look at Haskell's faux union Either. It should be true that Either a a = a but of course, it isn't and you always have to destructure this.
In inference it's easier to just infer one most general type instead of a (possibly infinite) number of sets of types.
Basicaly wherever types are ambiguous, you'd need to try all alternatives and possibly compile all of them.
Faux unions are also underused but we do find them from time to time.