3 ms·
> There are five core principles behind Ritchie: ... No reserved keywords, everything is redefinable. Why is this a principle? What advantage does it confer?
by 6502nerdface 11y ago
> There are five core principles behind Ritchie: ... No reserved keywords, everything is redefinable.
Why is this a principle? What advantage does it confer? My initial reaction is that this will result in nightmarish code.
- nostrademons 11y agoMakes it easy to build EDSLs. Very often, in an EDSL you want your users to be able to use a language that's almost like the host language, but has one or two key constructs redefined. I'm not sure it's the choice I would've made, but I can see it being very attractive for someone whose primary experience with programming is designing a programming language. Back when I was interested in PL design in college, I was a big fan of this property in languages as well.
- blacksqr 11y agoSee e.g. FORTRAN.
- vorg 11y agoWhen there's a close match between a lexical rule and a semantic rule, it's easier to remember how to use the semantics. Most languages have an arbitrary rule for distinguishing between an identifier (it begins with letter, except for 30 to 80 special cases) and keyword (30 to 80 special cases) which is hard to remember. When the rule is that the first character of an alphanumeric sequence determines whether it references a number (it begins with digit) or identifier (it begins with letter), that's easy to remember. Golang extends that idea by also distinguishing between public (beginning with uppercase) and private variables in this way, but it still falls short on its rule for recognizing the 50-odd keywords and special identifiers. Languages that have simple lexical-semantic matches enable people to program in it without IDE's or other crud.