lua-users home
lua-l archive

Re: continuations (was Re: error() or nil, 'error msg')

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wednesday, September 24, 2014 10:07:29 PM Andrew Starks wrote:
> Does this mean that we're going to loose coroutines? :)
If by "loose" you mean "set free", then yes perhaps it will.
(My apologies. It was too good to pass up.)
But instead of seeing goto as a continuation, what if it's a tail-call?
 function A()
 local N=0
 local C=function()
 N=N+1
 goto B
 end
 N=1+C()
 ::B::
 return N
 end
 print(A())
Does this print 1 or 2? Assuming a hypothetical Lua that allows such a thing.
-- 
tom <telliamed@whoopdedo.org>

AltStyle によって変換されたページ (->オリジナル) /