lua-users home
lua-l archive

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

Hash: SHA1

Duncan Cross wrote:
> Are you sure you need any arguments? It seems like you could use
> upvalues external to all your state functions, instead. For example,
> doing a blind-rewrite your nsieve example from later in your post:

That was my initial plan (the one that made me groan and give up on it).
The problem with this approach is that in order to allow my translated C
functions to be reentrant, all the upvalues need to be unique to a
particular invocation of the function. In other words, take your
example, and wrap a function around it... so that when the C function is
called, all the closures are created and then state_0 run.

Passing lots of arguments around means that we don't have to create (and
then discard) lots of closures every time we call a C function. This
would only work if argument passing was efficient, of course.

Bear in mind, though, that I've been thinking about this for all of ten
minutes now and there's likely to be something I'm missing. I haven't
done anything on Clue for ages.

- --
┌─── ───── ─────
│ "There is nothing in the world so dangerous --- and I mean *nothing*
│ --- as a children's story that happens to be true." --- Master Li Kao,
│ _The Bridge of Birds_
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla -