Skip to content

NEP10 Comment character

Greg Hewgill edited this page Nov 28, 2019 · 1 revision

This proposal changes the comment character from % to #.

History

When the Neon syntax was first developed, the # character was chosen for not-equals as in Modula-2 (if you squint it looks sort of like an equals sign with two slashes through it). It was also used in a "based number" syntax, for example 0#16#123abc for a hex number. This led to the choice of % for a comment lead-in character (both for % line comments and %| block comments |%).

Eventually the not-equals operator was changed to <> for readability reasons (and still accepts the Unicode in any case). And recently the based number syntax was removed in NEP9 Base literal number syntax.

Proposal

Given that:

  • # is a very common comment character;
  • % is uncommon;
  • The # character is now unused in Neon:

Change the comment character in Neon to #:

print("this is a") # line comment
#|print("and a block comment)
print("looks like this")|#

This also removes the grammar special case for the "shebang" line (which is always #!).