[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Re: RE: Object oriented scope? (again)
- From: Andre de Leiradella <leiradella@...>
- Date: Tue, 17 Jun 2003 14:54:42 -0300
>1. Lua allows a function call in the form "function table-constructor" or
"function string-literal". This shouldn't be too hard to handle; just make
sure that { or " or
>[[ (not [[--) trigger the :. (I don't think I've ever used so much
punctuation in one sentence)
I'm rewriting the pre-processor and I'll include those cases.
>2. (more tricky) keep in mind that objects may want to store references to
external functions in member variables (for callbacks and suchlike). Seems
like the
>@@ syntax would work here; just make sure to explicitly document that it's
for more than just static functions.
I didn't think of this... if you store a function 'a' as a member variable
of an object instance then self.a(...) would call the function with the
given args. With the pre-processor, if you write @a(...) it will be changed
to self:a(...), which inserts the "ghost" parameter self... I think that the
only way to work this through is to check weather 'a' is a method defined in
the class or not. I'll consider adding a format string for @ so the
pre-processor will be fully customizeable and cases like this treated as the
user sees fit.
>You might also consider, instead of a preprocessor, patching the lua
parser; it may be the simplest way to handle subtle issues such as nested
block comments and
>other special cases. It would also undoubtedly be more tightly integrated
with the compiler, allowing a single source for syntax error messages. I
have to admit,
>though, that my suggestion is not entirely selfless; I've been meaning to
patch the parser for my own uses for some time, and would be extremely
interested to hear
>the experiences of others in working with that code.
I agree with Lua authors that a hand written parser will be smaller than a
automatically generated one so it fits better inside the Lua core, but it
would be nice if them or someone else could write a stand alone yacc parser
that generates Lua bytecode that everybody could play with. Or maybe a good
documentation about Lua bytecodes.
Andre de Leiradella
http://www.geocities.com/andre_leiradella/