Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
July 22, 2010 [D1] capitalize cannot be interpreted at CT | ||||
---|---|---|---|---|
| ||||
Could somebody please explain this error to me. ---- import std.uni : toUniUpper; import std.string : capitalize; void main() { const char[] name = `test`; // C:\dmd\src\phobos\std\string.d(983): Error: _aApplycd2 cannot be interpreted at compile time, because it has no available source code const char[] name_c = capitalize(name); // my partial solution const char[] name_c2 = cast(char)toUniUpper(name[0]) ~ name[1..$]; } ---- |
July 22, 2010 Re: [D1] capitalize cannot be interpreted at CT | ||||
---|---|---|---|---|
| ||||
Posted in reply to strtr | 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.
|
July 22, 2010 Re: [D1] capitalize cannot be interpreted at CT | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ellery Newcomer | == Quote from Ellery Newcomer (ellery-newcomer@utulsa.edu)'s article > 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. Thanks, found it: http://d.puremagic.com/issues/show_bug.cgi?id=3512 |
July 22, 2010 Re: [D1] capitalize cannot be interpreted at CT | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ellery Newcomer | 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.
|
July 22, 2010 Re: [D1] capitalize cannot be interpreted at CT | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | 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? -- ... <IXOYE>< |
July 22, 2010 Re: [D1] capitalize cannot be interpreted at CT | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | 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.
- Jonathan M Davis
|
July 22, 2010 Re: [D1] capitalize cannot be interpreted at CT | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On Thu, 22 Jul 2010 13:25:04 -0400, Jonathan M Davis <jmdavisprog@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
|
Copyright © 1999-2021 by the D Language Foundation