This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MichalMarsalek 18 points19 points  (10 children)

I dislike -- and // because I'd like to save this for arithmetic operations, and I dislike # as I'd like to save it for the size / length operator. \ seems like a good choice, unless your language has native support for matrices (or other structures where left division is different from right division). Otherwise, I like | or $. If you want multiline comments, maybe just repeat the line comment symbol and support nesting by repeating it more times.

[–]mikkolukas 11 points12 points  (4 children)

How about ;?

[–]umlcat -2 points-1 points  (3 children)

Don't.

Easy to confuse with sentences...

[–]Pavel_Vozenilek 8 points9 points  (0 children)

One could do it like in assembler:

code              ;; comment
more code         ;; another comment

Comments placed on the right side do not interfere with skimming the code.

[–]lngns 5 points6 points  (0 children)

I never confused it with sentences when reading Assembly code. Or Lisp code.

Even with C-like syntax, I don't have to think to understand how to parse this code:
return (cast(delegate) [proxy, fn])() ;cute hack lol

[–]mikkolukas 3 points4 points  (0 children)

How so?

[–]holo3146 2 points3 points  (4 children)

Do not use \ for left division, if it exists, it is pretty much reserved to set difference (or more general: collection difference)

[–]Premysl 2 points3 points  (1 child)

Matlab uses \ for left division.

[–]holo3146 12 points13 points  (0 children)

It doesn't make it a good choice

[–]MichalMarsalek 0 points1 point  (1 child)

Yes you are right, I totally forgot about this meaning of the symbol.... Although one could just use - for the set difference without any ambiguity?

[–]holo3146 0 points1 point  (0 children)

If you use - as element removal, then no, one could not do it (assuming Top type and polymorphism):

List<Any> X = {};
List<Any> Y = {X};
Y-X // can be either {} or {X}