[erlang-questions] Multi-line comments in Erlang
Daniel Goertzen
daniel.goertzen@REDACTED
Thu Dec 9 16:58:05 CET 2010
Thank you for reminding me about HEREDOCs. In Python, I often use triple
quoted strings for multiline comments. It works well, but they are exposed
to the interpreter which smells a bit. What if erlang had HEREDOCs *plus* a
way to mark any string as a comment. Some illustrations, using Python's
triple quoting as HEREDOC format.
X="""
This is
a multiline heredoc
""",
...
%"""
This is
a multiline comment
"""
myfun(X, Y %"An inline comment", Z) -> ...
So comment and string delimiting uses the exact same logic, but you stick a
% in front to mark it as a comment instead of a string.
Dan.
On Thu, Dec 9, 2010 at 3:48 AM, Zvi . <zvi.avraham@REDACTED> wrote:
> 1. The beauty of dynamic languages is that you don't need tools and IDEs!
> And even if you do use tools, many times you work not on your machine or on
> target headless environments, with only basic editor available, or with
> editor that you know poorly or which didn't configured with your macros,
> etc.
>
> 2. Comments are essentially Natural language (let's say US English)
> document, embedded into Programming language (Erlang) document.
> Therefore, embedded document should be left intact. Ideally I would like
> comments to be something, like HEREDOC.
>
> 3. Free format is the king! Language designers shouldn't dictate
> programmers
> how to format and ident their code.
> How differnt is starting comment line from '%' in Erlang, from putting 'C'
> or '*' in the first column in FORTRAN?
>
> 4. In other languages, that doesn't have multiline comments I often use
> ifdef(false) macro, or outright if(false) to "comment out" parts of code. I
> think it's uglier, than proper multiline comments, but still better than
> comment every single line.
>
> Zvi
>
> On Tue, Dec 7, 2010 at 8:20 PM, Rapsey <rapsey@REDACTED> wrote:
>
> > Is it that important? Any proper programming editor can comment/uncomment
> > multiple lines.
> >
> >
> > Sergej
> >
> >
> > On Tue, Dec 7, 2010 at 5:49 PM, Zvi . <zvi.avraham@REDACTED> wrote:
> >
> >> Why do you think it's not possible?
> >> It's just simple change to Erlang source code parser.
> >> Probably this should be submitted as EEP, so OTP team will consider it.
> >>
> >> On Tue, Dec 7, 2010 at 6:25 PM, James Churchman <
> jameschurchman@REDACTED
> >> >wrote:
> >>
> >> > not posible in erlang, but many editors (eg i use textmate) will
> comment
> >> > and uncomment multiple lines with % on each line..
> >> > On 7 Dec 2010, at 15:32, Zvi wrote:
> >> >
> >> > > Hi,
> >> > >
> >> > > Matlab/Octave has single line comments, like Erlang (i.e. starting
> >> > > with '%' sign). But it also have multi-line comments, like for
> >> > > example:
> >> > >
> >> > > %{
> >> > > this is example
> >> > > of multi-line
> >> > > comments in Matlab
> >> > > %}
> >> > >
> >> > > which is equivalent to:
> >> > >
> >> > > %this is example
> >> > > %of multi-line
> >> > > %comments in Matlab
> >> > >
> >> > > How difficult is to add comments like this to Erlang?
> >> > >
> >> > > Thanks,
> >> > > Zvi
> >> > >
> >> > > ________________________________________________________________
> >> > > erlang-questions (at) erlang.org mailing list.
> >> > > See http://www.erlang.org/faq.html
> >> > > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
> >> > >
> >> >
> >> >
> >>
> >
> >
>
More information about the erlang-questions
mailing list