Utilizing ++ and -- for comments

Since ++ and -- wont see the light of day in ruby, can we use it for comment
notation?

define:
1. -- equal to # comment
2. --- (or more dashes) equal to =begin
   next --- (or more) equal to =end
3. ++ same comment as #1 above
4. +++ same comment as #2 above

Reasons:
1. I like "--", very clean [1]
2. We can faq ++/-- questions as: "they are used for comments" :slight_smile:

kind regards -botp

···

--
[1] Eg

cat a1.rb

-----------------------------------
Program Name: Sample_Programming.rb
Purpose: this a sample prg showing
- same as =begin and =end comments.
clean, don't you think so? imho
-----------------------------------

p "hello, world"

p "hello, ruby" -- this is just a sample

-- I know
p "hello, world, ruby."

I also think that the =begin, =end notation is not comfortable to use.
Maybe some other way of multiline comments should be added in Ruby 1.9
for example /* */ or %c{ }

-g.

+1

""Peña, Botp"" <botp@delmonte-phil.com> wrote in message
news:20050212025029.603D4824F@mx1.delmonte-phil.com...

···

Since ++ and -- wont see the light of day in ruby, can we use it for
comment
notation?

define:
1. -- equal to # comment
2. --- (or more dashes) equal to =begin
  next --- (or more) equal to =end
3. ++ same comment as #1 above
4. +++ same comment as #2 above

Reasons:
1. I like "--", very clean [1]
2. We can faq ++/-- questions as: "they are used for comments" :slight_smile:

kind regards -botp

--
[1] Eg

cat a1.rb

-----------------------------------
Program Name: Sample_Programming.rb
Purpose: this a sample prg showing
- same as =begin and =end comments.
clean, don't you think so? imho
-----------------------------------

p "hello, world"

p "hello, ruby" -- this is just a sample

-- I know
p "hello, world, ruby."

I would like to see a multi-line that can nest other multi-line
comments. useful for quick and dirty code changes.

--- Disable this entire section
    --- My other section that holds
        important documentation.

···

On Sat, 12 Feb 2005 11:47:03 +0900, "Peña, Botp" <botp@delmonte-phil.com> wrote:

Since ++ and -- wont see the light of day in ruby, can we use it for comment
notation?

define:
1. -- equal to # comment
2. --- (or more dashes) equal to =begin
   next --- (or more) equal to =end
3. ++ same comment as #1 above
4. +++ same comment as #2 above

    ---
    code ... ...
---

so this is a problem. Lua has some interesting comments. They are ugly
but they have some nice uses. see http://www.lua.org/pil/1.3.html
(bottom half). Any ideas how we could clean it up a bit? I like the
single hyphen toggle.

Brian.

Hi --

Since ++ and -- wont see the light of day in ruby, can we use it for comment
notation?

They've already seen the light of day:

irb(main):001:0> ++ 100
=> 100
irb(main):002:0> -- 100
=> 100

And we have comment mechanisms already too :slight_smile:

define:
1. -- equal to # comment
2. --- (or more dashes) equal to =begin
  next --- (or more) equal to =end
3. ++ same comment as #1 above
4. +++ same comment as #2 above

Reasons:
1. I like "--", very clean [1]

I understand that not everyone likes the hash-mark comment idiom. But
isn't this just another of the thousand things where it is literally
impossible for everyone to have it exactly how they want, and Matz has
gone ahead and made a reasonable decision? We can of course talk
about what looks best (and not agree), what's easiest to type (and not
agree), what will/won't make Perl/C/Java/etc. programmers feel at home
(and not agree about whether we care :-), and so forth. But that will
be true no matter what the comment mechanism is.

David

···

On Sat, 12 Feb 2005, [iso-8859-1] "Peña, Botp" wrote:

--
David A. Black
dblack@wobblini.net

Come on! Real programmers don't comment their code. It was hard to
write, it should be hard to understand :wink:

Kind Regards,
Ed

···

On Sat, 12 Feb 2005 11:47:03 +0900, "Peña, Botp" <botp@delmonte-phil.com> wrote:

Since ++ and -- wont see the light of day in ruby, can we use it for comment
notation?

--
Encontrá a "Tu psicópata favorito" http://tuxmaniac.blogspot.com

for example /* */

That's a regex

I wouldn't mind the (* *) syntax though, and *() are all baside
eachother on my kbrd so nice and easy to type :slight_smile:

Douglas

"Brian Mitchell" <binary42@gmail.com> wrote in message
news:fcfe4170050212060072e48cdb@mail.gmail.com...

···

On Sat, 12 Feb 2005 11:47:03 +0900, "Peña, Botp" <botp@delmonte-phil.com> > wrote:

Since ++ and -- wont see the light of day in ruby, can we use it for
comment
notation?

define:
1. -- equal to # comment
2. --- (or more dashes) equal to =begin
   next --- (or more) equal to =end
3. ++ same comment as #1 above
4. +++ same comment as #2 above

I would like to see a multi-line that can nest other multi-line
comments. useful for quick and dirty code changes.

--- Disable this entire section
   --- My other section that holds
       important documentation.
   ---
   code ... ...
---

+++ Disable this section
   --- My other section that holds
      important documentation.
   ---
   code ... ...
+++

Interesting. What does that do? Integer identity op?

Cheers,
Navin.

···

David A. Black <dblack@wobblini.net> wrote:

They've already seen the light of day:

irb(main):001:0> ++ 100
=> 100
irb(main):002:0> -- 100
=> 100

Brian Mitchell <binary42@gmail.com> writes:

Since ++ and -- wont see the light of day in ruby, can we use it for comment
notation?

define:
1. -- equal to # comment
2. --- (or more dashes) equal to =begin
   next --- (or more) equal to =end
3. ++ same comment as #1 above
4. +++ same comment as #2 above

I would like to see a multi-line that can nest other multi-line
comments. useful for quick and dirty code changes.

--- Disable this entire section
    --- My other section that holds
        important documentation.
    ---
    code ... ...
---

Here's yer multiline comment:

g@crash:~/tmp$ cat test.rb
puts 1
%{
  puts 2
  %{
    puts 3
  }
  puts 4
}
puts 5
g@crash:~/tmp$ ruby test.rb
1
5

so this is a problem. Lua has some interesting comments. They are ugly
but they have some nice uses. see Programming in Lua : 1.3
(bottom half). Any ideas how we could clean it up a bit? I like the
single hyphen toggle.

And here's yer "single-hyphen" toggle:

g@crash:~/tmp$ cat test.rb
def q; yield end

puts 1
%q{
  puts 2
  %q{
    puts 3
  }
  puts 4
}
puts 5
g@crash:~/tmp$ ruby test.rb
1
5
g@crash:~/tmp$ cat test.rb
def q; yield end

puts 1
q{
  puts 2
  %q{
    puts 3
  }
  puts 4
}
puts 5
g@crash:~/tmp$ ruby test.rb
1
2
4
5

<grin>

···

On Sat, 12 Feb 2005 11:47:03 +0900, "Peña, Botp" <botp@delmonte-phil.com> wrote:

(In response to news:fcfe4170050212060072e48cdb@mail.gmail.com by Brian
Mitchell)

I would like to see a multi-line that can nest other multi-line
comments. useful for quick and dirty code changes.

See also this entry:
18.12: Why don't C comments nest? How am I supposed to comment out
        code containing comments? Are comments legal inside quoted
        strings?
        the wild mate and nest normally. The San Diego Zoo believes it
        has managed to convince some C comments to nest, but it's hard
        to tell how much of that is really in the preprocessor, and how
        much of it is just bovine fecal matter.
    -- from the FAQ for comp.lang.c

k

···

A: We believe it has something to do with captivity; C comments in

Hi,

At Sat, 12 Feb 2005 22:23:40 +0900,
Douglas Livingstone wrote in [ruby-talk:130595]:

> for example /* */

That's a regex

A regex beginning with * is illegal, but

  %/string/*2

is valid syntax.

I wouldn't mind the (* *) syntax though, and *() are all baside
eachother on my kbrd so nice and easy to type :slight_smile:

Also,

  p(*[1,2,3])

···

--
Nobu Nakada

Douglas Livingstone <rampant@gmail.com> writes:

for example /* */

That's a regex

I wouldn't mind the (* *) syntax though, and *() are all baside
eachother on my kbrd so nice and easy to type :slight_smile:

Why do you guys always propose comment syntaxes of icky languages? }:slight_smile:

···

Douglas

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

Same as:

  +(+(100))

and

  -(-(100))

- Jamis

···

On 00:01 Sun 13 Feb , Navindra Umanee wrote:

David A. Black <dblack@wobblini.net> wrote:
> They've already seen the light of day:
>
> irb(main):001:0> ++ 100
> => 100
> irb(main):002:0> -- 100
> => 100

Interesting. What does that do? Integer identity op?

--
Jamis Buck
jamis_buck@byu.edu
http://jamis.jamisbuck.org
------------------------------
"I am Victor of Borge. You will be assimil-nine-ed."

Navindra Umanee ha scritto:

···

David A. Black <dblack@wobblini.net> wrote:

They've already seen the light of day:

irb(main):001:0> ++ 100
=> 100
irb(main):002:0> -- 100
=> 100

Interesting. What does that do? Integer identity op?

they do
+(+(100)) -> 100
and
-(-(100)) -> 100

nothing magic :slight_smile:

Actually, it's an "Infrequently asked Question"
http://www.plethora.net/~seebs/faqs/c-iaq.html

···

On Sun, 13 Feb 2005 18:01:42 +0900, Kaspar Schiess <eule@space.ch> wrote:

See also this entry:
                -- from the FAQ for comp.lang.c

--
Gavri
---------------------------------------------------
I blog here: http://gavri.blogspot.com

"Christian Neukirchen" <chneukirchen@gmail.com> schrieb im Newsbeitrag news:m27jld99qj.fsf@lilith.local...

Douglas Livingstone <rampant@gmail.com> writes:

for example /* */

That's a regex

I wouldn't mind the (* *) syntax though, and *() are all baside
eachother on my kbrd so nice and easy to type :slight_smile:

Why do you guys always propose comment syntaxes of icky languages? }:slight_smile:

That's exactly the same question that I had in mind while reading this thread...

    robert

Why do you guys always propose comment syntaxes of icky languages? }:slight_smile:

All I'm after are multi line comments - if you've got some non-icky
syntax I'm all for it :slight_smile:

/* */

If it doesn't qualify as a regex, I'm all for it!

Douglas

Why do you guys always propose comment syntaxes of icky languages?

}:slight_smile:

well, anything instead of =begin, =end!!

-g.

(In response to news:e3ecfac7050213012659b598aa@mail.gmail.com by Gavri
Fernandez)

Whoa thanks bunches for the pointer :wink: Had taken that out of an old
quotes file here locally.

kaspar

code manufacture - ruby lab
www.tua.ch/ruby