------ art_56222_33046854.1176787051003
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
I would like to see any comments to this question too.
irb(main):001:0> pr roc.new {next 99}
#<Proc:0x02c5cbe4@(irb):1>
irb(main):002:0> pr.call
99
irb(main):003:0>
irb(main):004:0* pr ambda {next 99}
#<Proc:0x02c58684@(irb):4>
irb(main):005:0> pr.call
nil
Does seem counter to what is written in the PickAxe, "next" in case of Proc
created by Kernel.lambda does *not* return the value passed to it, though
it does exit the block.
- Nasir
On 4/16/07, FindSun <findsun / gmail.com> wrote:
>
> 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 ambda {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,
>
> --
> FindSun <Findsun / Gmail.COM>
>
>
------ art_56222_33046854.1176787051003--