[D1] capitalize cannot be interpreted at CT

Steven Schveighoffer schveiguy at yahoo.com
Thu Jul 22 10:41:00 PDT 2010


On Thu, 22 Jul 2010 13:25:04 -0400, Jonathan M Davis  
<jmdavisprog at gmail.com> wrote:

> On Thursday, July 22, 2010 06:53:30 BCS wrote:
>> Hello Don,
>>
>> > Ellery Newcomer wrote:
>> >> On 07/21/2010 09:09 PM, strtr wrote:
>> >>> Could somebody please explain this error to me.
>> >>
>> >> evidently ctfe can't eat
>> >>
>> >> foreach(i, dchar d; s){
>> >> }
>> >> Bleach. Make sure it's in bugzilla.
>> >
>> > CTFE currently doesn't work on *any* functions which are implemented
>> > in druntime, because it doesn't have access to their source code.
>>
>> Why don't they have access?
>
> All you have for druntime are .di files (so basically header files  
> rather than
> full-on source files) and the library file with the compiled source, so  
> you don't
> have the source. Now, as to _why_ that's all you have, I don't know (the  
> .d files
> come with phobos). But you need the .d files for the full source, and  
> without
> them, you won't be able to use CTFE with the functions in them.

Well, it's somewhat different than that.  For something like foreach(i,  
dchar d; s), the compiler recognizes this as a special runtime function  
and replaces it with a call to the special function that handles that.  I  
don't think the code for running it is any .di file in druntime.

-Steve


More information about the Digitalmars-d-learn mailing list