[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

utilizing ++ and -- for comments

Peña, Botp

2/12/2005 2:47:00 AM

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" :-)

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."






26 Answers

George Moschovitis

2/12/2005 8:33:00 AM

0

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.

Douglas Livingstone

2/12/2005 1:24:00 PM

0

> 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 :)

Douglas


nobu.nokada

2/12/2005 1:39:00 PM

0

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 :)

Also,

p(*[1,2,3])

--
Nobu Nakada


Christian Neukirchen

2/12/2005 1:41:00 PM

0

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 :)

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

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


Dave Burt

2/12/2005 1:42:00 PM

0

+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" :-)
>
> 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."
>
>
>
>
>
>


Robert Klemme

2/12/2005 1:48:00 PM

0


"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 :)
>
> Why do you guys always propose comment syntaxes of icky languages? }:-)

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

robert

Douglas Livingstone

2/12/2005 2:00:00 PM

0

> Why do you guys always propose comment syntaxes of icky languages? }:-)

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

/* */

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

Douglas


Brian Mitchell

2/12/2005 2:01:00 PM

0

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 ... ...
---

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

Brian.



Dave Burt

2/12/2005 2:24:00 PM

0


"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 ... ...
+++


dblack

2/12/2005 2:47:00 PM

0