News for hackers. Stuff that matters.
Re:White space does matter in C23 by nerdponx on Thursday January 18, 2024 @02:44PM (#39046600)
Meanwhile both SQL (and more recently Python) have tokens that are keywords in certain contexts and regular identifiers in others.
Re:White space does matter in C23 by Findecanor on Thursday January 18, 2024 @03:03PM (#39046875)
PL/I was infamous for it being possible to express valid code that read "IF IF THEN THEN ELSE ELSE".
Re:White space does matter in C23 by colejohnson66 on Thursday January 18, 2024 @03:16PM (#39047026)
Yep. One of the goals was that there would be no reserved words. Not sure why.

    IF IF = THEN THEN THEN = ELSE ELSE = END END
Re:White space does matter in C23 by layer8 on Thursday January 18, 2024 @05:54PM (#39049089)
C++ has some contextual keywords as well:

  final (C++11)
  override (C++11)
  import (C++20)
  module (C++20)
Re:White space does matter in C23 by wyldfire on Thursday January 18, 2024 @07:39PM (#39050119)
But did they make those contextual in order to avoid conflicts with code that had existing identifiers before the new keyword was specified?
Re:White space does matter in C23 by layer8 on Friday January 19, 2024 @07:16AM (#39054564)
Yes.
Re:White space does matter in C23 by tsimionescu on Friday January 19, 2024 @01:36AM (#39052237)
C# 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).
Re:White space does matter in C23 by twic on Thursday January 18, 2024 @06:20PM (#39049363)
Java 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.htm...