Fully dynamic d by opDotExp overloading

Yigal Chripun yigal100 at gmail.com
Sat Apr 18 22:39:48 PDT 2009


On 19/04/2009 01:22, BCS wrote:
> Hello Yigal,
>
>> On 18/04/2009 21:16, Andrei Alexandrescu wrote:
>>
>>> In the syntax
>>>
>>> a.b
>>>
>>> how would either of a and b be identified at runtime? I mean, you
>>> write the code somewhere and it gets compiled. It's not like you're
>>> reading "a.b" from the console and then call some eval() function
>>> against them.
>>>
>>> Andrei
>>>
>> what prevents D from having an eval function?
>> suppose someone modifies the DMD front-end to compile a string with
>> the
>> source code of a function in-memory, than this is processed by
>> something
>> based on DDL and what you get is an API call that takes source code in
>> a
>> string and returns a function pointer.
>
> Even then it is *still* going to be compile time. Just a compile time
> running at runtime... Ooohh, my heads's going to start hearing here in a
> bit.
>
>
No it won't. you will call a standard library API at *runtime* with a 
*runtime* string and get back a pointer to a function that you can call. 
in fact Some Lisp compilers implement eval() exactly like that.
you're thinking in C++ terms. try thinking in Lisp...



More information about the Digitalmars-d mailing list