r/programming • u/Elfet • Oct 26 '26
I'm Building My Own Programming Language
https://medv.io/blog/i-am-building-my-own-programming-language
0
Upvotes
r/programming • u/Elfet • Oct 26 '26
2
u/ketralnis Oct 26 '26 edited Oct 26 '26
This is cool:
So once a subtype has annotated you can just go on using it without a separate cast which feels very natural. But what is the type of
sif I askif s is Circle || s is Rect?Also:
Exhaustiveness checking for
enum/uniontypes is fairly common (off of the top of my head, Rust in the C family and the entire ML family) but usually that comes in a separatematchkeyword or some other destructuring system becauseifcan also be used in ways likewhere most of the time you don't need it. So do all of your
ifs require exhaustiveness? (Looking at your other examples no.) Or just if I happen to inquire about a type, and now it's not a normalifbut some otherif-looking thing that's semantically unrelated but syntactically identical? Isif s is Circle || is_sky_blue()one of these type-destructuring exhaustiveifs? Since there are two separateifsystems I think that context-sensitivity means that if I copy-paste some code it could have different rules in the new place than it did in the old place, right?Along similar lines:
I guess that is syntax sugar for something like
Which is very surprising, that inserting an
ifstatement can change the type for the rest of the scope. Even if it's not and it's instead sugar forthen it still means that changing earlier parts of a function has surprising impacts on the later parts, and also raises questions about what if the type of
accountisSystemAccount | UserAccount | null, that this sort of check doesn't scale to?I'd really recommend spending some time looking at other programming languages beyond Typescript and Go since this is clearly inspired by those but the rest of the PL world has taken these and other ideas much further and with more rigour. e.g. the "no methods" and "no coloured functions" sections describe problems nearly exclusive to Javascript. Not making those specific choices isn't an advantage, it's just not making the specific mistakes that Javascript and nobody else makes
2
u/badpotato Oct 28 '26
I guess as long as you don't license the ant programming language as apache, it's alright.
1
u/Primary_Ads Oct 26 '26 edited Oct 26 '26
hope you can find users but i find nothing interesting about your proposed language. it reads like someone who used exclusively javascript and go and nothing else. maybe the experience on expr doesnt translate well to PL work, idk.