[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [new feature proposal for versions after 5.0 final] passing argum ents to chunks
- From: Benoit Germain <bgermain@...>
- Date: Fri, 21 Feb 2003 10:00:05 +0100
Hello,
I know that 5.0 final is is feature freeze status, but then, the sooner
proposals are in the pipeline for the next version the better :-)
So, here it is:
Basically, passing a script or precompiled buffer to the parser results in a
lua closure left on the stack of the lua state. Actually doing what the
buffer defines is done by calling it. My suggestion is to enable argument
passing, as is possible for any "regular" function call (currently it is
possible to call the resulting function with arguments, but of course these
are ignored because the chunk has no means to access them). Of course this
requires a syntax addition which could look like :
chunkparams <param list>
...
Most probably nothing but comments or empty lines can be allowed before the
chunkparams statement, which acts just like the parameter list in a function
declaration. As far as I can tell, this would not require any change in the
virtual machine, but only in the parser, to modify the closure's prototype
and account for these variables during compilation.
Any thoughts about this ?
Benoit.