MiniD 1.0 released!
Chris Nicholson-Sauls
ibisbasenji at gmail.com
Wed Aug 1 13:49:53 PDT 2007
Jarrett Billingsley wrote:
> "Robert Fraser" <fraserofthenight at gmail.coim> wrote in message
> news:f8pdsq$1p4l$1 at digitalmars.com...
>> Awesome; great job. From a cursory look, I like what's going on there, but
>> the things keeping me from turning away from Perl for general scripting
>> purposes are the lack of an eval() and first-class regexes. Still, this
>> looks like an awesome language for scripting within the context of another
>> application, which I guess is the point.
>>
>> Anyways, congratulations on 1.0!
>
> Oh, but it *does* have eval! OK, so because of the design of the
> implementation, it can't access local variables, but it's still there in
> both the scripting language and the native API.
>
> Thanks for the reply :)
>
>
Ah, but since it *does* have access to 'varargs', could you not use
loadString (eval's older brother of sorts) and pass the generated
function the locals you need? :)
____[ MiniD ]____________________________________
|
| local x, y ;
| // bunch of stuff
|
| x, y = loadString("
| local x, y = varargs ;
| // do some dynamic stuff with x and y
| return x, y;
| ")(x,y);
|_________________________________________________
Sure its more explicit... it also means the code string doesn't have to
actually know the names of the local variables; ie, you could reuse the
same string for other functions, or better yet store the generated
function under its own name and use it like any other function.
-- Chris Nicholson-Sauls
More information about the Digitalmars-d-announce
mailing list