From: Brian Candler on 1 Jul 2010 05:31 Jesús Gabriel y Galán wrote: > Check your Trash folder, maybe Gmail is sending > Brian's emails there. That's OK, my mails are usually trash anyway :-) There have been occasional gatewaying problems between ruby-talk and ruby-forum, but not this time. A good way to check is to look at the ruby-talk mailing list archives, linked from http://ruby-lang.org/en/community/mailing-lists/ -- Posted via http://www.ruby-forum.com/.
From: Josh Cheek on 1 Jul 2010 05:59 [Note: parts of this message were removed to make it a legal post.] On Wed, Jun 30, 2010 at 8:55 AM, Brian Candler <b.candler(a)pobox.com> wrote: > Josh Cheek wrote: > > Note: can anyone explain to me what unary * is? > > It's just the "splat". AFAIK it's not really an operator and is not > mapped to a method call; it's part of the language syntax. > -- > Posted via http://www.ruby-forum.com/. > > I am still unsure what it is, I think that when it is parsed, it just invokes the to_a method, and then does some interpreter level magic to line up the args and the params. Anyway, it definitely invokes to_a (I expect this is similar to how the ampersand invokes to_proc) def y(x) def x.to_a() [12] end yield *x end y(/1,2,3/) { |param| param } # => 12
First
|
Prev
|
Pages: 1 2 3 Prev: Taking out text between symbols and joining together Next: optparser question |