lua-users home
lua-l archive

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


Tony Finch <dot@dotat.at> writes:

> On Wed, 13 Jan 2010, David Kastrup wrote:
>> Tony Finch <dot@dotat.at> writes:
>> >
>> > What I meant was how to represent the coupling between the instruction
>> > pointer and the program state in the source code. You can represent
>> > each state as a function so that state transitions are tailcalls.
>>
>> But that often causes contortions as well.  You gain a lot more
>> expressive power if "state transitions are calls" merely.  Sometimes it
>> is not easy to arrange for a call to get tail.
>
> If you implement a state transition as a non-tail-call then you'll get
> unbounded stack growth.

Not if you can get back to the same state only via a state transition
implemented as a return.

-- 
David Kastrup