From: Tomas Matousek Date: 2007-08-20T09:04:29+09:00 Subject: Lambda return value --_000_F58FE69873E2D5459B72C347DE15824116B61980CBNAEXMSGC112re_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable In the following sequence of calls/yields all return values are 1 except fo= r the marked one (the next statement returning a value from lambda). Is that an intention with some good reason for it or a bug? def y; yield; end l =3D lambda { 1 } puts l[] p =3D Proc.new { 1 } puts p[] l =3D lambda { next 1 } puts l[] # nil (why?) p =3D Proc.new { next 1 } puts p[] l =3D lambda { 1 } puts y(&l) p =3D Proc.new { 1 } puts y(&p) l =3D lambda { next 1 } puts y(&l) p =3D Proc.new { next 1 } puts y(&p) Tomas --_000_F58FE69873E2D5459B72C347DE15824116B61980CBNAEXMSGC112re_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

In the following sequence of calls/yields all return v= alues are 1 except for the marked one (the next statement returning a value from lambda).

Is that an intention with some good reason for it or a= bug?

 

def y; yield; end

 

l =3D lambda { 1 }

puts l[]

 

p =3D Proc.new { 1 }

puts p[]

 

l =3D lambda { next 1 }

puts l[]            =                        &nb= sp;# nil (why?)

 

p =3D Proc.new { next 1 }

puts p[]

 

l =3D lambda { 1 }

puts y(&l)

 

p =3D Proc.new { 1 }

puts y(&p)

 

l =3D lambda { next 1 }

puts y(&l)

 

p =3D Proc.new { next 1 }

puts y(&p)

 

Tomas

--_000_F58FE69873E2D5459B72C347DE15824116B61980CBNAEXMSGC112re_--