lua-users home
lua-l archive

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


Jay Carlson <nop@nop.com> writes:

> In the context of Lua, it bothers me to have such an important
> distinction made solely by statement position.  Would treturn or tail
> statements help?

I remember some language spec that used the syntax

        goto CALL-STATEMENT;

to tell the the compiler that it must pop the current frame before the
call statement is executed.  Otherwise, the call is equivalent to

        return CALL-STATEMENT;

for non-void producing calls, and

        CALL-STATEMENT;
        return;

for void producing calls.

As best I can remember, the spec was never implemented, as the idea
received negative feedback.

Besides, the default should be tail calls as gotos so that the
compiler can generate better code, and the user should have to do
something unusual to force the odd restriction on the compiler.

John