[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04130] Re: Function objects. was: What are you usi ng Ruby for?

From: Dave Thomas <Dave@...>
Date: 2000-07-19 13:47:50 UTC
List: ruby-talk #4130
kjana@os.xaxon.ne.jp (YANAGAWA Kazuhisa) writes:

> In message <E536C8EE2A1FD31195370008C79FFA1F13F66F@world.cinnober.com>
> aleksi.niemela@cinnober.com writes:
> 
> >   Parameter passing   all supported ways        only plain  (*)
> (snip)
> >   *) no optional, grouped (*rest) or named parameters allowed, 
> >      nor block block association
> 
> Parameters for a block is bound as multiple assignment. Therefore you
> can:

And in fact that means you can do stuff that you _can't_ do in a
method, such as the totally useless:

     def fred
       yield [ 1, 2, [3, 4, 5], 6, 7, 8 ]
     end

     fred { |a,(b,c),(d, *e),*f| p a,b,c,d,e,f }
  =>
     1
     2
     nil
     3
     [4, 5]
     [6, 7, 8]


Regards



Dave

In This Thread

Prev Next