Strange answer by YAML

x,xx = *nil
p x.class => NilClass
p xx.class => NilClass

x, xx= *YAML.load("")
p x.class => FalseClass
p xx.class => NilClass

Feature or bug ?

···

--
Posted via http://www.ruby-forum.com/.

irb -r yaml
irb(main):001:0> YAML.load("")
=> false

So the return value from load is in a and as there are no more values,
the rest of the variables (in this case xx) gets nil
Without * the results are the same:

irb -r yaml
irb(main):001:0> x,xx = nil
=> [nil]
irb(main):002:0> p x.class
NilClass
=> nil
irb(main):003:0> p xx.class
NilClass
=> nil
irb(main):004:0> x, xx= YAML.load("")
=> [false]
irb(main):005:0> p x.class
FalseClass
=> nil
irb(main):006:0> p xx.class
NilClass
=> nil

···

On 7/12/07, Michel Demazure <michel@demazure.com> wrote:

x,xx = *nil
p x.class => NilClass
p xx.class => NilClass

x, xx= *YAML.load("")
p x.class => FalseClass
p xx.class => NilClass

Feature or bug ?

--
Luis Parravicini
http://ktulu.com.ar/blog/

Luis Parravicini wrote:

So the return value from load is in a and as there are no more values,
the rest of the variables (in this case xx) gets nil
Without * the results are the same:

Thanks, MD

···

--
Posted via http://www.ruby-forum.com/\.