From: David Vallner Date: 2006-02-22T10:50:01+09:00 Subject: Re: Syntax questions Dňa Streda 22 Február 2006 02:33 listrecv@gmail.com napísal: > A few simple syntax questions: > > 1) Anyway to do use the default arg for nonlast params? Something > like: > run(xyz, , 3) > I don't think so, would be a PITA to parse / check against typos. Use an options hash when you need funky method invocation forms. > 2) Veru often I see things like: > a, b = meth() > Is meth returning two objects? Or is it returning one object - like a > tuple or something - which the parser automagically splits into a & b? > What are the rules of using two vars with commas together? > It's returning an Array, which is then automagically split in the parallel assignment construct. david@chello082119107152:~$ irb irb(main):001:0> a, b = [1, 2] => [1, 2] irb(main):002:0> a => 1 irb(main):003:0> b => 2 Might possibly change in 1.9 / 2.0 to reduce the ambiguity and general mystery surrounding parallel assignment in strange cases. (Basically, once the number of lvalues and rvalues differs, things get mildly funky, and it's only downhill from there) David Vallner