Why the 'next' call within the Proc obj created by 'lambda' always returns nil on ruby 1.8.6?

F

FindSun

Hi, guys,

I am one of the chinese translators for "Programming Ruby 2nd". And
one reader in China reported that the 'next' call within the Proc obj
created by 'lambda' always returns nil, instead of the specified
value.

E.g., (the code snippets is from page 358)

pr = lambda {next 99}
puts pr.call

While, for the Proc obj created by Proc#new, it works fine.

Could you please have a look, why 1.8.5/6 changed to that way? Or it's
just a bug?

Regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,006
Latest member
LauraSkx64

Latest Threads

Top