elm-lang / elm-plans

no longer in use, just want to keep discussions around
BSD 3-Clause "New" or "Revised" License
29 stars 1 forks source link

Nicer syntax for comment blocks #25

Closed dasch closed 8 years ago

dasch commented 8 years ago

The current comment syntax is sort of baffling for me:

{-
this is a comment!
-}

Especially the "documentation" syntax seems weird:

{-|
I'm a documentation string!
-}

I know this is entirely subjecting, and feel free to close this if you think it's stupid, but I think this would be much, much nicer:


---
I'm a comment block!

---

Basically, using a "horizontal line" to separate the comment from its surroundings. Since two dashes are already used for line-level comments, this is a much less alien syntax. I'd suggesting either doing away with the special syntax for doc comments or using four dashes to mark those.

jvoigtlaender commented 8 years ago

Note that the {- and -} has the potential for nesting, which your proposal has not.

Say you have some big chunk of code, including comments, in your file:

...
{-
some comment
-}
some code
...
more stuff like above
...

Now, for some reason during development, you want to temporarily outcomment that whole chunk (several functions) in your file. You can do that by surrounding the whole chunk as follows:

{-
...
{-
some comment
-}
some code
...
more stuff like above
...
-}

Now think about what would happen if you tried the same with --- as both start and end markers of comments. :smile:

dasch commented 8 years ago

I've just never had that problem in all my years of doing Ruby development :-/ is this really something that people do?

mgold commented 8 years ago

Ruby's multi-line comment syntax is basically unused, much less any nesting... I agree, it's nice to have the capability to nest comments.

jvoigtlaender commented 8 years ago

@dasch, about whether or not people do/want that (maybe in some languages, but not in others): search the internet for "nested comments" (probably you don't even need to add "programming"), then prepare for a long afternoon of reading pro and cons discussions.

dasch commented 8 years ago

Yeah, guess this is a no-go then, especially since the current syntax is already there :-/ it just feels like there's so much... syntax. Well, closing this.

mgold commented 8 years ago

FWIW, Elm 0.16 will actually have less syntax than 0.15.