multi line comments in ruby

Discussion in 'Ruby' started by Artur Merke, Nov 10, 2003.

  1. Artur Merke

    Artur Merke Guest

    Hi,

    some time (years ;-) ago there was a discussion about multi line comments
    in ruby on this list. I didn't follow it completely, just found it in
    news.google. There were sth. about 60 postings but AFAIK today (and it is
    2 years later!) there is still no other way to make multi line comments
    in ruby then the cumbersome

    =begin
    ....
    =end

    block? Is this right, or have I simply missed something?

    IMHO a simple c/c++ style comment

    /*
    ....
    */

    is missing in ruby!


    Artur

    _______________________________________________________________________________
    Artur Merke
    |||
    (O-O)
    _____________________________________________.oo0--(_)--0oo.___________________
     
    Artur Merke, Nov 10, 2003
    #1
    1. Advertising

  2. "Artur Merke" <-dortmund.de> schrieb im Newsbeitrag
    news:p-dortmund.de...
    > Hi,
    >
    > some time (years ;-) ago there was a discussion about multi line

    comments
    > in ruby on this list. I didn't follow it completely, just found it in
    > news.google. There were sth. about 60 postings but AFAIK today (and it

    is
    > 2 years later!) there is still no other way to make multi line comments
    > in ruby then the cumbersome
    >
    > =begin
    > ...
    > =end
    >
    > block? Is this right, or have I simply missed something?
    >
    > IMHO a simple c/c++ style comment
    >
    > /*
    > ...
    > */
    >
    > is missing in ruby!


    Personally I don't miss it since I don't find =begin =end tedious. As far
    as I remember there was some problem with the language syntax that
    prevented usage of /* */. And, after all: Ruby != C... :)

    Regards

    robert
     
    Robert Klemme, Nov 10, 2003
    #2
    1. Advertising

  3. * Artur Merke; Mon, 10 Nov 2003 10:28:17 +0100

    > some time (years ;-) ago there was a discussion about multi line comments
    > in ruby on this list. I didn't follow it completely, just found it in
    > news.google. There were sth. about 60 postings but AFAIK today (and it is
    > 2 years later!) there is still no other way to make multi line comments
    > in ruby then the cumbersome
    >
    >=begin
    > ...
    >=end


    Here's an evil hack that you should *not* use:

    _=<<_
    This
    is
    a
    multiline
    pseudo-comment
    _


    Josef 'Jupp' Schugt
     
    Josef 'Jupp' Schugt, Nov 10, 2003
    #3
  4. "Josef 'Jupp' Schugt" <> schrieb im Newsbeitrag
    news:bop7am$1hbu6a$-berlin.de...
    > * Artur Merke; Mon, 10 Nov 2003 10:28:17 +0100
    >
    > > some time (years ;-) ago there was a discussion about multi line

    comments
    > > in ruby on this list. I didn't follow it completely, just found it in
    > > news.google. There were sth. about 60 postings but AFAIK today (and

    it is
    > > 2 years later!) there is still no other way to make multi line

    comments
    > > in ruby then the cumbersome
    > >
    > >=begin
    > > ...
    > >=end

    >
    > Here's an evil hack that you should *not* use:


    I'm wondering why you present it. Isn't that contradictory?
    :)

    robert
     
    Robert Klemme, Nov 11, 2003
    #4
  5. Artur Merke

    Dave Brown Guest

    In article <-dortmund.de>,
    Artur Merke <-dortmund.de> wrote:
    : Hi,
    :
    : some time (years ;-) ago there was a discussion about multi line comments
    : in ruby on this list. I didn't follow it completely, just found it in
    : news.google. There were sth. about 60 postings but AFAIK today (and it is
    : 2 years later!) there is still no other way to make multi line comments
    : in ruby then the cumbersome
    :
    : =begin
    : ...
    : =end
    :
    : block? Is this right, or have I simply missed something?
    :
    : IMHO a simple c/c++ style comment
    :
    : /*
    : ...
    : */
    :
    : is missing in ruby!

    No great loss. (I know, I know, I sound like one of those
    annoying people who say "no, you don't NEED features and
    functionality!", but bear with me here.)

    If you ever go through lots of C code, you'll probably notice that
    most multiline comments--at least those written in code by good
    programmers who have to work with other people--you'll probably
    notice this:

    /* Multiline comments have a row of stars down the left hand side
    * of the comment block so that the comment stands out from the
    * rest of the code. Heck, my text editor (vim) automatically put
    * these stars in for me.
    */

    I have a sneaky feeling that "use a text editor that cooperates
    with you" addresses another issue that you'd have with the lack of
    multi-line comments--it's harder to type them in and reformat them
    when you have to keep worrying about the '#' marks everywhere.
    Fear not! A decent code editor will worry about that for you.
    Also, it's nice to have an easy way to do one-liner comments;
    witness the fact that C++'s "//" is now a standard comment
    character in the C99 standard.

    At least it's not a capital C in the first column.

    Now, because Matz provides features (and you use them), you do
    still have =begin/=end, but I usually use those for embedded-
    documentation things rather than for comments. Personally, I
    prefer to have comments that are obviously comments, even when I'm
    not using a syntax-highlighting editor. Perhaps your text editor
    is cooperating too well with you? :)

    --Dave
     
    Dave Brown, Nov 12, 2003
    #5
  6. Hi!

    * Robert Klemme; 2003-11-17, 14:18 UTC:
    > "Josef 'Jupp' Schugt" <> schrieb im Newsbeitrag
    > news:bop7am$1hbu6a$-berlin.de...
    > > Here's an evil hack that you should *not* use:

    >
    > I'm wondering why you present it.


    Because it exists.

    > Isn't that contradictory?


    No, I say one should not use it as in 'refrain from using it unless
    you precisely know what you are doing' (the RFC SHOULD that is :).

    Josef 'Jupp' Schugt
    --
    .-------.
    message > 100 kB? / | |
    sender = spammer? / | R.I.P.|
    text = spam? / ___| |___
     
    Josef 'Jupp' SCHUGT, Nov 17, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,139
  2. Monk
    Replies:
    10
    Views:
    1,480
    Michael Wojcik
    Apr 20, 2005
  3. dean
    Replies:
    5
    Views:
    472
    Phlip
    Jun 4, 2006
  4. Alexandre Mutel
    Replies:
    16
    Views:
    787
    Alexandre Mutel
    Nov 19, 2009
  5. Replies:
    4
    Views:
    616
    Dr John Stockton
    Jun 3, 2006
Loading...

Share This Page