Hacker News new | past | comments | ask | show | jobs | submit login

Something I never quite understood about languages was why they are restricted to one or another domain. For example the author writes:

Algebraic types? Dependent types? You'll never see them. They're too ... research-y

Why can't those features be baked into C++ or Java?




I think C++ is full now.


People keep saying that yet the standards committee keeps nailing new tentacles on.

http://c2.com/cgi/wiki?ExtraLegsOntoaDog


Well as far as I know neither language is clever enough to allow arbitrary proofs to be expressed at compile-time. (I hear that C++'s template system is Turing-complete, which may or may not be true, but even if it is, that doesn't mean that dependent types could be expressed in a way that's easy to write/read.) So you'd have to essentially rewrite a big part of the compiler if you were to "bake dependent types" into C++ or Java, which is of course easier said than done. Not to mention that dependent types are extraordinarily complicated and have only been implemented in research systems.


Java has a fixed assembly-language level syntax. Look to Scala or F#


Well, you can add ADT's to C/C++ with a macro system: https://github.com/eudoxia0/cmacro/blob/master/t/good-macros...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: