Aesthetics: - yes it could conceivable be mistaken for some sort of commented Dictionary and its reminiscent of any algol based language block structure ( C, Java, C#, ...)
OTOH if the line is thought of as cobra it is commented ( leading # as next point) and the Cobra language is not syntax oriented from anything algol like anyway
Leading # as line comment
True but thats the idea - # is a comment #<something> is a comment block leadin (line comment on steroids).
Compare with augmentations of C language for doc or pretty display or formatting purposes
( /* vs /** and /**********************************************...) - its still a comment but more-than a single line comment.
Editor recognition: Not been a problem to date. Most editors support both single line and multiline commenting as a hierarchy with multiline being 'higher' than single - at least thats been the case with the (small) sample I've tried configuring with this...
I chose a # leading trigraph reasonably deliberately:
- Leading # to have some similarity or closeness to the # line comment - on an eyeball code scan then anything with a leading # is instantly and solely identified as some comment form.
- The trailing char { as indicative of this being a block enclosure (therefore '}' as closing the block. (alternatives would be () [], perhaps // or \\ or /\,...)
the other advantage of these chars is that most editors have some existing for support balanced bracket matching to jump to end/start of these.
- the middle # ( or leading double #) to indicate some sort of extended comment ( # is comment, ## is comment with extra sauce) and also to make the token less likely to collide
with some line commented out code ( like a dictionary literal).
Yeah it might be convenient to have floating block comments from anywhere in a line - I havent had a need for it yet strong enough make an itch worth scratching but..
Theres also something of a complexity issue with a floating block comment that starts/ends in the middle of a line ( pathologically) - what does that do with (commented and uncommented) indentation?
For your example in a mostly line oriented language I'd just insert a comment for the remainder of the line and insert the replacement
- Code: Select all
foo(x, y ,z ) # y blah, z)
OR just
- Code: Select all
foo(x, y, z) # y blah
Just for avoiding explaining what happens to indentation across multiple block commented lines when the block comment initiator and terminator are embedded in the middle of lines
and for cobra syntax being mostly line oriented I'd keep the blocking comments as also commenting the remainder of the lines they occur on
(even to the extent of forcing them to be available only at the start of lines...)
e.g. Is the indentation syntax on this valid ?
- Code: Select all
/* foo(x)
blah(y)
z(x) */ fooBlahZ(x,y)
(No) - 4spaces before initiator, 1 after - how easy is it to tell
removing the space before fooBlahZ merges the active code into the comment (visually), adding more spaces screws the indentation level.........
Is /* ..*/ cobra like ?
Cobras not (strongly) C/Java/C# syntax flavoured elsewhere so I'd submit that it is not.
# is the comment indicator already - perhaps /# ..... #/ would be acceptably disagreeable to all ??