top | item 29356118

LemonScript: A typed programming language inspired by TypeScript and Python

49 points| elisaado | 4 years ago |plebussupremus1234.github.io | reply

14 comments

order
[+] tylermenezes|4 years ago|reply
I don't think this is a particularly serious attempt at a programming language but it's impressive coming from a 13 year old.
[+] flashgordon|4 years ago|reply
Wait really? That is pretty impressive for a 13 year old. I'd say pretty impressive even for some one in their teens (even doing a toy language following the Stanford pl courses online is no easy feat!!).
[+] hn_throwaway_99|4 years ago|reply
Thanks, that context makes a lot more sense. Kudos to the author then.
[+] karmakaze|4 years ago|reply
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.
[+] maweki|4 years ago|reply
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.

[+] zfxfr|4 years ago|reply
The link leads to a 404 but there's a menu so it is not a big problem.
[+] JDeArte|4 years ago|reply
Inspired by Python? Like they overheard someone talking about Python before they implemented some feature? all I see are "{", "}", and ";" everywhere ;-)
[+] lolinder|4 years ago|reply
`init`, `self`, the comment syntax, `and`, `or`, and the import syntax are all pretty clearly python-inspired, to name a few. "Curly braces or no curly braces" is not the only syntax decision a language has to make.

There's obviously a lot more inspiration from typescript, but they do list python second in the title, so that's fair.

[+] nhumrich|4 years ago|reply
I think it's just the "print ()" syntax
[+] masswerk|4 years ago|reply
Something suggests to me that PlebusSupremus1234 would have loved AS3.

(I still think that AS3 type hints were a viable approach.)