[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: invasive parameters as method mode variables

Peña, Botp

12/7/2006 4:18:00 AM

:From => "Trans [mailto:transfire@gmail.com]"
# each(:separator => //)

hmm, interesting. ' seems my mind likes that style. sometimes i'd wish #each can receive a param, so i don't have to remember all those each_* and #to_enum thingies. That would mean i could do something like the ff

each(:char)
each(:byte)
each(:with_index)
each(:separator => /\s/)
each(:separator => ":")

?

kind regards -botp

1 Answer

Trans

12/8/2006 1:38:00 PM

0


Pe?a wrote:
> :From => "Trans [mailto:transfire@gmail.com]"
> # each(:separator => //)
>
> hmm, interesting. ' seems my mind likes that style. sometimes i'd wish #each can receive a param, so i don't have to remember all those each_* and #to_enum thingies. That would mean i could do something like the ff
>
> each(:char)
> each(:byte)
> each(:with_index)
> each(:separator => /\s/)
> each(:separator => ":")
>
> ?

quite. it seems matz doesn't care for symobolic paramters of this kind.
once i even asked him about a special case modification in arg
interpretation and precedence so we could do things like:

each:char
each:byte
each:with_index
each:byte:with_index

matz didn't like. i think i can understand, there are pros and cons.
the important con is it would make subclassing and overriding a method
more difficult.

(OT) he also said he had a different idea for using ':' in a method
name. other then :after and :back i wonder what it is and if it has
some general application?

t.