String Mixins & Compile Time Evaluation

Kuba Ober kuba at mareimbrium.org
Fri Nov 27 21:50:36 PST 2009


Don wrote:
> Bill Baxter wrote:
>> On Tue, Nov 17, 2009 at 4:17 AM, Don <nospam at nospam.com> wrote:
>>> Bill Baxter wrote:
>>>> On Tue, Nov 17, 2009 at 2:07 AM, Don <nospam at nospam.com> wrote:
>>>>> Travis Boucher wrote:
>>>>>> I've been playing with string mixins, and they are very powerful.
>>>>>>
>>>>>> One thing I can't figure out is what exactly can and cannot be 
>>>>>> evaluated
>>>>>> at compile time.
>> How about C functions?  Any chance those'll ever work?  Particularly C
>> stdlib functions.  They're one of the major things I'm finding
>> prevents std.string functions from being used CTFE.
> 
> I don't think it could ever work. CTFE needs to have the source available.
> If we really needed to, a few C stdlib functions could be made into CTFE 
> intrinsics. But in general, no.
> Some form of if(__ctfe) will happen, though.

What about having compile-time access to dynamic libraries, implemented
via dlopen() etc? Basically a compile-time FFI? There's nothing 
fundamentally unkosher about that, or so it seems to me. It would 
certainly be a big jaw-dropper feature for a C-like language. LISP has
it, right? :)

Cheers, Kuba


More information about the Digitalmars-d-learn mailing list