5 ms·
Meanwhile both SQL (and more recently Python) have tokens that are keywords in certain contexts and regular identifiers in others.
by nerdponx 3y ago
Meanwhile both SQL (and more recently Python) have tokens that are keywords in certain contexts and regular identifiers in others.
- Findecanor 3y agoPL/I was infamous for it being possible to express valid code that read "IF IF THEN THEN ELSE ELSE".
- deleted 3y ago[deleted]
- layer8 3y agoC++ has some contextual keywords as well: final (C++11) override (C++11) import (C++20) module (C++20)
- wyldfire 3y agoBut did they make those contextual in order to avoid conflicts with code that had existing identifiers before the new keyword was specified?
- layer8 3y agoYes.
- tsimionescu 3y agoC# is probably the king of contextual keywords, they have tens of them. They started I believe with `yield return` and `yield break` and then added all of the LINQ ones (select, from, where etc), and kept adding others (notnull, record, required, etc).
- twic 3y agoJava too: > A further ten character sequences are restricted keywords: open, module, requires, transitive, exports, opens, to, uses, provides, and with. These character sequences are tokenized as keywords solely where they appear as terminals in the ModuleDeclaration, ModuleDirective, and RequiresModifier productions (§7.7). https://docs.oracle.com/javase/specs/jls/se12/html/jls-3.html#jls-3.9-200 https://docs.oracle.com/javase/specs/jls/se12/html/jls-3.htm...