UPDATE: After extensive consideration of alternative comment syntaxes,
;
was retained...with a suggested policy of spacing line comments off by two spaces, not one:my [line of] code ; like this my [line of] code ; not this my [line of] code ;; or this my [line of] code ;-- or this
Various factors made this choice seem best. The rise of in-language invisibles made it possible to create your own comment structures...even using things like
--
and//
to ignore to end of line...so long as what you wanted to ignore was LOADable. This aligned with the general goal of giving the most symbols possible to the language, vs. to something that would throw data out and be impossible to use.The visual compromise of two spaces off for same-line comments addressed enough of the complaints about ; to be palatable. Further, it should be noted that at least one space is required to consider a comment to be a comment. This allows
;
to be a character in ISSUE! (e.g. #;) or in URL!, where it is legal. It's not a legal word character, so abc; triggers an error.
One of the things that Rebol has wanted to go after is the idea that you don't need an IDE or syntax highlighting to feel the code is readable or looking pleasing.
(I've felt like there is something of a similarity of goals here with MarkDown; that the idea you could pull the code out of an old-school typewriter and feel the lack of any kind of rendering engine isn't a liability.)
On this note, the use of semicolons for comments in Rebol has never felt good to me. Semicolons standing alone almost look like dirt; they're too light and broken-up to feel like a good "barrier".
some (code [that looks]) kind of Englishy ; a Rebol comment
The solutions that have come along feel like they're making the problem worse, and I resent having to "make something up" to tack on more characters that are optional as decoration to make up for how weak semicolon is:
double (semicolons [are also]) broken-dirty ;; a Rebol comment
semicolon (and [dashes aren't]) really better ;-- a Rebol comment
Historically, semicolons come from Lisp and its family...as well as many assembly languages. Besides the complaints I give about it, I'm certain it looks quirky unnatural to the average programmer of today.
The two notably popular choices for end-of-line comments are //
from many C-derived languages (originally a C++ invention, but added to C--which is saying something, because C has been very reluctant to take C++-isms)...and the #
which is popular in shell/scripting languages. For a big survey of forms of comments, Rosetta Code has it covered:
Languages targeting people who are thinking more about compiling things--not just Java but even more recent ones like Rust, Scala, Haxe--have gone with with the C/C++ conventions. (Of course, JavaScript went with it too, for those of you who don't know.)
Meanwhile languages that seem to be more in the script space have gone with #
...but not just the usual suspects like Awk/Sed/Perl/PHP/YAML, but PowerShell, Ruby, Python, Julia...
I don't think repeating random mistakes because they are popular is a good idea. But there seems to be a kind of visual truth about these stronger separating choices. When I have to use some other language and then come back to Rebol and accidentally start commenting with //
or #
, I think about how much better the resulting code looks.
(I encourage others to experiment and see how you feel.)
There's obviously an issue (ha) with using #
with no space after it as a comment, since that is how ISSUE! is denoted. I don't really feel like requiring a space after it to get comment behavior is so bad, as #this looks bad anyway
. Though repeating # should be legal, to kind of draw separators, e.g.
######### This should be able to be a comment ##########
It feels much more solid than:
;;;;;;;;;; This terrible abomination ;;;;;;;;;;;;;;;;;;;;
Sometimes I think #
is perhaps a bit too heavy, and the //
reminds me of one of my historically favorite marking patterns... standardized by OSHA to mean "physical hazard":
////////// This is actually kind of cool /////////////////
So I've got some mixed feelings personally about liking //
, and also thinking //
makes for a pretty poor Rebol WORD! (try putting it in a PATH!) so it would be nice to make it illegal there--which declaring it a comment would do. But it seems when you look at the group of languages Rebol is most aiming at that # makes more sense, as well as being able to accomplish the goal of the desired barrier in a single character instead of two.
There's also the need to support shebang in some way, and it would be easier if things like #!
were not issues but treated as comments...which could go with the ##
types of exceptions above.