4 ms·
> Why are <> so terrible? I mean, they’re more accessible than {}. The problem is parsing complexity, they have to be disambiguated from the corresponding oper
by masklinn 11y ago
> Why are <> so terrible? I mean, they’re more accessible than {}.
The problem is parsing complexity, they have to be disambiguated from the corresponding operators (also the right shift `>>`), so either the syntax has to be such that they can't appear in the same context and can be trivially differentiated, or you got yourself an exponentially harder to parse language.
- iSnow 11y agoSeriously? Some people either have a really weak mental model of a language or want to see problems where there are none. With the same right one could argue that {} can't be used for generics etc. since most people also have to write JS from time to time and it will confound the hell out of their language parser when switching languages.
- masklinn 11y ago> Seriously? Some people either have a really weak mental model of a language or want to see problems where there are none. Er… mate I'm talking about actual parsers here, as in the stuff that follows the tokenizer…
- fao_ 11y agoThat can be solved relatively simply with lookahead, can't it?
- nly 11y agoNope, because you can have arbitrary constant expressions within template instantiations. foo<bar<1> could be interpreted as "foo<(bar < 1)>" or "foo < bar<1>" It's undecidable without symbol lookup.