why dosn't ruby support // to comment?

Discussion in 'Ruby' started by bin liu, Jan 11, 2005.

  1. bin liu

    bin liu Guest

    bin liu, Jan 11, 2005
    #1
    1. Advertising

  2. Because // is an empty regular expression.

    Alex
     
    Alexey Verkhovsky, Jan 11, 2005
    #2
    1. Advertising

  3. --_0111-1140-26-PART-BREAK
    Content-Type: text/plain

    > i think use keyboard type "//" is fast than "#" to comment one line
    > code.


    Alex already answered.
    Furthermore Bin Liu, typing '#' is faster than '//' on my UK keyboard: it
    requires only one key to be pressed rather than two. In different keyboard
    layouts this may not be the case, but honestly I don't see the problem.

    Cheers,
    Antonio
    --
    My programming blog: http://antoniocangiano.com

    --_0111-1140-26-PART-BREAK--
     
    Antonio Cangiano, Jan 11, 2005
    #3
  4. bin liu

    Guest

    Hi,

    At Tue, 11 Jan 2005 15:38:21 +0900,
    bin liu wrote in [ruby-talk:125995]:
    > i think use keyboard type "//" is fast than "#" to comment one line code.


    And also, # is necessary for shebang line.

    --
    Nobu Nakada
     
    , Jan 11, 2005
    #4
  5. bin liu

    Stefan Lang Guest

    Antonio Cangiano wrote:

    >> i think use keyboard type "//" is fast than "#" to comment one line
    >> code.

    >
    > Alex already answered.
    > Furthermore Bin Liu, typing '#' is faster than '//' on my UK keyboard: it
    > requires only one key to be pressed rather than two. In different keyboard
    > layouts this may not be the case, but honestly I don't see the problem.
    >


    On a German keyboard: Shift+7 Shift+7 to get '//' but only
    one keystroke to get a '#'.

    --
    Stefan
     
    Stefan Lang, Jan 11, 2005
    #5
  6. On Tue, 2005-01-11 at 19:37 +0900, Antonio Cangiano wrote:
    > Alex already answered.
    > Furthermore Bin Liu, typing '#' is faster than '//' on my UK keyboard: it
    > requires only one key to be pressed rather than two.


    Really? Must see UK keyboard then.
    Didn't know that?!

    Archit
     
    Archit Baweja, Jan 11, 2005
    #6
  7. Re: why dosn't ruby support // to comment?

    > Really? Must see UK keyboard then.
    > Didn't know that?!


    After a quick google:

    http://rjbs.manxome.org/images/2002/exile/matts/keyboard.jpg

    It is just to the left of the enter key. My # is above my three, which
    is easy to hit - shift on the right hand, 3 on the left.

    Douglas
     
    Douglas Livingstone, Jan 11, 2005
    #7
  8. bin liu wrote:
    > i think use keyboard type "//" is fast than "#" to comment one line
    > code.


    What is faster depends on the keyboard layout. With a german keyboard
    layout '#' is a single key, while '/' requires pressing two keys
    simultanously. With a dutch keyboard layout (essentially NL) it is the
    other way round.

    If you want something that is fast and easy on almost any keyboard you
    use '--'.

    Josef 'Jupp' Schugt
    --
    Where on the ringworld does that 'Lord of the Rings' guy live?
     
    Josef 'Jupp' Schugt, Jan 12, 2005
    #8
  9. Re: why dosn't ruby support // to comment?

    On Thu, 13 Jan 2005 22:38:03 +0900, Christian Neukirchen
    <> wrote:
    > Josef 'Jupp' Schugt <> writes:
    > > If you want something that is fast and easy on almost any keyboard you
    > > use '--'.

    >
    > Too bad it has the icky taste of SQL. :)
    >


    But, that's also a comment in Haskell ;)

    Ed
    --
    Alcohol is the anesthesia by which we endure the operation of life.
    -- George Bernard Shaw
     
    Edgardo Hames, Jan 13, 2005
    #9
  10. bin liu

    Zach Dennis Guest

    Re: why dosn't ruby support // to comment?

    Edgardo Hames wrote:
    > On Thu, 13 Jan 2005 22:38:03 +0900, Christian Neukirchen
    > <> wrote:
    >
    >>Josef 'Jupp' Schugt <> writes:
    >>
    >>>If you want something that is fast and easy on almost any keyboard you
    >>>use '--'.

    >>
    >>Too bad it has the icky taste of SQL. :)
    >>

    >
    >
    > But, that's also a comment in Haskell ;)


    That is also the comment in AppleScript.

    Zach
     
    Zach Dennis, Jan 13, 2005
    #10
  11. Re: why dosn't ruby support // to comment?

    Zach Dennis schrieb:
    > Edgardo Hames wrote:
    >
    >> On Thu, 13 Jan 2005 22:38:03 +0900, Christian Neukirchen
    >> <> wrote:
    >>
    >>> Josef 'Jupp' Schugt <> writes:
    >>>
    >>>> If you want something that is fast and easy on almost any keyboard you
    >>>> use '--'.
    >>>
    >>>
    >>> Too bad it has the icky taste of SQL. :)
    >>>

    >>
    >>
    >> But, that's also a comment in Haskell ;)

    >
    >
    > That is also the comment in AppleScript.
    >
    > Zach
    >
    >

    Why don't make it userdefined:
    $COMMENT_BEGIN="/*"
    $COMMENT_END="*/"
    $COMMENT_LINE="--"
    ;)
    I don't think you'll ever satisfy the calls for a new comment syntax.

    Peter
     
    Peter Schrammel, Jan 14, 2005
    #11
  12. Re: why dosn't ruby support // to comment?

    On Friday 14 January 2005 12:41 am, Peter Schrammel wrote:
    | Why don't make it userdefined:
    | $COMMENT_BEGIN="/*"
    | $COMMENT_END="*/"
    | $COMMENT_LINE="--"
    | ;)
    | I don't think you'll ever satisfy the calls for a new comment syntax.

    Watch me...

    $COMMENT_WRAP = { "^=begin" => "^=end", "/*" => "*/" }
    $COMMENT_LINE = [ "#", "--", "//" ]

    ;)

    Okay, maybe not _everybody_.

    trans.
     
    trans. (T. Onoma), Jan 14, 2005
    #12
  13. bin liu

    Zsban Ambrus Guest

    On Tue, Jan 11, 2005 at 04:11:31PM +0900, Alexey Verkhovsky wrote:
    > Because // is an empty regular expression.


    Not only that, but also a division by a regular expression.

    That might sound silly, but in the pike programming language, you can split
    strings with the / operator. Thus, someone might want to do this in ruby:

    class String; alias_method :/, :split; end;
    w1, w2 = "foo:bar"//:/; puts w2;

    And to carry it even further, one can consider these examples too:

    A division of a character constant:

    puts ?//5;

    Or a division of a symbol:

    class Symbol; def /(x); x.send(self, 2); end; end;
    puts ://5;

    But of course these last two cases could still be exceptions from the
    comment syntax, just like # now is not a comment in single quotes either.

    (But note that the // comment could be normal syntax in C too before it was
    accepted by C99, for example this expression

    9//*foo*/2

    has different meaning in traditional C and C99.)

    ambrus
     
    Zsban Ambrus, Jan 14, 2005
    #13
  14. Zsban Ambrus wrote:

    > (But note that the // comment could be normal syntax in C too before it was
    > accepted by C99, for example this expression
    >
    > 9//*foo*/2
    >
    > has different meaning in traditional C and C99.)


    What does it do?
     
    Florian Gross, Jan 14, 2005
    #14
  15. Florian Gross wrote:
    > Zsban Ambrus wrote:
    >
    >> (But note that the // comment could be normal syntax in C too before
    >> it was
    >> accepted by C99, for example this expression
    >>
    >> 9//*foo*/2
    >>
    >> has different meaning in traditional C and C99.)

    >
    >
    > What does it do?
    >


    Even when using modern gcc, if you specify option "--traditional", this
    expression will be compiled without errors as "9/2". Without this
    option, gcc interprets "//" as the beginning of a line comment with all
    consequences.

    Gennady.
     
    Gennady Bystritksy, Jan 14, 2005
    #15
  16. bin liu

    Guest

    Re: why dosn't ruby support // to comment?

    Hi,

    At Fri, 14 Jan 2005 07:49:10 +0900,
    Zach Dennis wrote in [ruby-talk:126354]:
    > >>>If you want something that is fast and easy on almost any keyboard you
    > >>>use '--'.
    > >>
    > >>Too bad it has the icky taste of SQL. :)

    > >
    > > But, that's also a comment in Haskell ;)

    >
    > That is also the comment in AppleScript.


    IIRC, also in Ada.

    --
    Nobu Nakada
     
    , Jan 15, 2005
    #16
  17. bin liu

    Tim Heaney Guest

    Re: why dosn't ruby support // to comment?

    writes:
    >
    > At Fri, 14 Jan 2005 07:49:10 +0900,
    > Zach Dennis wrote in [ruby-talk:126354]:
    >> >>>If you want something that is fast and easy on almost any keyboard you
    >> >>>use '--'.
    >> >>
    >> >>Too bad it has the icky taste of SQL. :)
    >> >
    >> > But, that's also a comment in Haskell ;)

    >>
    >> That is also the comment in AppleScript.

    >
    > IIRC, also in Ada.


    Also in Lua.
     
    Tim Heaney, Jan 15, 2005
    #17
  18. Re: why dosn't ruby support // to comment?

    Tim Heaney ha scritto:
    > writes:
    >
    >>At Fri, 14 Jan 2005 07:49:10 +0900,
    >>Zach Dennis wrote in [ruby-talk:126354]:
    >>
    >>>>>>If you want something that is fast and easy on almost any keyboard you
    >>>>>>use '--'.
    >>>>>
    >>>>>Too bad it has the icky taste of SQL. :)
    >>>>
    >>>>But, that's also a comment in Haskell ;)
    >>>
    >>>That is also the comment in AppleScript.

    >>
    >>IIRC, also in Ada.

    >
    >
    > Also in Lua.


    and, it seem to me, also in eiffel
     
    gabriele renzi, Jan 15, 2005
    #18
  19. Re: why dosn't ruby support // to comment?

    gabriele renzi wrote:
    > Tim Heaney ha scritto:
    > > writes:
    > >
    > >>At Fri, 14 Jan 2005 07:49:10 +0900,
    > >>Zach Dennis wrote in [ruby-talk:126354]:
    > >>
    > >>>>>>If you want something that is fast and easy on almost any

    keyboard you
    > >>>>>>use '--'.
    > >>>>>
    > >>>>>Too bad it has the icky taste of SQL. :)
    > >>>>
    > >>>>But, that's also a comment in Haskell ;)
    > >>>
    > >>>That is also the comment in AppleScript.
    > >>
    > >>IIRC, also in Ada.

    > >
    > >
    > > Also in Lua.

    >
    > and, it seem to me, also in eiffel


    Hitler.
     
    Daniel Berger, Jan 15, 2005
    #19
  20. bin liu

    Pete Elmore Guest

    Re: why dosn't ruby support // to comment?

    Daniel Berger wrote:
    > gabriele renzi wrote:
    >
    >>Tim Heaney ha scritto:
    >>
    >>> writes:
    >>>
    >>>
    >>>>At Fri, 14 Jan 2005 07:49:10 +0900,
    >>>>Zach Dennis wrote in [ruby-talk:126354]:
    >>>>
    >>>>
    >>>>>>>>If you want something that is fast and easy on almost any

    >
    > keyboard you
    >
    >>>>>>>>use '--'.
    >>>>>>>
    >>>>>>>Too bad it has the icky taste of SQL. :)
    >>>>>>
    >>>>>>But, that's also a comment in Haskell ;)
    >>>>>
    >>>>>That is also the comment in AppleScript.
    >>>>
    >>>>IIRC, also in Ada.
    >>>
    >>>
    >>>Also in Lua.

    >>
    >>and, it seem to me, also in eiffel

    >
    >
    > Hitler.


    Daniel Berger seems to have lost the debate!
     
    Pete Elmore, Jan 15, 2005
    #20
    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. =?Utf-8?B?QWhtZWQgSGF6emFh?=

    The asp Tags dosn't appear

    =?Utf-8?B?QWhtZWQgSGF6emFh?=, Apr 26, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    410
    =?Utf-8?B?QWhtZWQgSGF6emFh?=
    Apr 26, 2005
  2. Samuel Shulman

    AllowSorting dosn't work

    Samuel Shulman, Jun 13, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    3,704
    Samuel Shulman
    Jun 13, 2006
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,216
    Smokey Grindel
    Dec 2, 2006
  4. Replies:
    11
    Views:
    1,149
  5. Marcin W.

    Autocomplete dosn't work with asp:LinkButton

    Marcin W., Aug 2, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    174
    Marcin W.
    Aug 2, 2005
Loading...

Share This Page