lua-users home
lua-l archive

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

On Thu, Jun 19, 2014 at 05:32:35PM -0300, Luiz Henrique de Figueiredo wrote:
> Lua 5.3.0 (work3) is now available for testing at
> MD5	4d50bbe8a2dffa5764caa099d2fa5d6b  -
> SHA1	ea5061a02f7b9f526562cda21ffa6fcf8c2f1ea9  -
> This is a work version. An updated reference manual is included but
> all details may change in the final version. See
> The main change in Lua 5.3.0 is the introduction of integers.
> For other changes, see
> Here are the main changes since work2:
> 	- exponentiation is only for floats
> 	- more functions in math handling integers
> 	- new API for continuation functions

As long as you're changing the function signature of C continuations: I
always thought it would be cool if the type of ctx was something like
intptr_t rather than int. That way I could use GCC's label address-of
operator, &&, without having to use a jump table or revert to using a switch
statement when resuming execution.

The problem with using a switch statement is that when you begin to wrap it
up in macros so it actually looks sane, you run into problems generating
unique case values. You usually use __LINE__ (if you're using a switch
statement you may as well try to remain standards compliant and portable,
rather than rely on something like __COUNTER___), but then you can't nest
invocations of your magic macro. A solution using computed gotos is not only
much faster (admittedly irrelevant for this discussion), but also solves the
issue of nesting.