View mode: basic / threaded / horizontal-split · Log in · Help
January 24, 2012
dstep/internal/Reflection.d:205:0 expression "objcObject_"c == cast(char[])field is not constant or does not evaluate to a bool
hi all :) i'm new to D and i'm trying to get step to compile on 
the Mac.  below is the template that gives the error: 
dstep/internal/Reflection.d:205:0 expression "objcObject_"c == 
cast(char[])field is not constant or does not evaluate to a bool

private template hasFieldImpl (T, string field, size_t i)
{
static if (T.tupleof.length == i)
 const hasFieldImpl = false;

else static if (T.tupleof[i].stringof[1 + T.stringof.length + 2 
.. $] == field)
 const hasFieldImpl = true;

else
 const hasFieldImpl = hasFieldImpl!(T, field, i + 1);  }

there error is on the line else static..

thanks very much
January 24, 2012
Re: dstep/internal/Reflection.d:205:0 expression "objcObject_"c == cast(char[])field is not constant or does not evaluate to a bool
On 2012-01-24 09:43, Robert Lumley wrote:
>
> hi all :) i'm new to D and i'm trying to get step to compile on the Mac.
> below is the template that gives the error:
> dstep/internal/Reflection.d:205:0 expression "objcObject_"c ==
> cast(char[])field is not constant or does not evaluate to a bool
>
> private template hasFieldImpl (T, string field, size_t i)
> {
> static if (T.tupleof.length == i)
> const hasFieldImpl = false;
>
> else static if (T.tupleof[i].stringof[1 + T.stringof.length + 2 .. $] ==
> field)
> const hasFieldImpl = true;
>
> else
> const hasFieldImpl = hasFieldImpl!(T, field, i + 1); }
>
> there error is on the line else static..
>
> thanks very much

I don't know if you're using a D1 or D2 compiler but that project is for 
D1. But I have basically abandoned that project in favor of:

http://michelf.com/projects/d-objc/

-- 
/Jacob Carlborg
January 24, 2012
Re: dstep/internal/Reflection.d:205:0 expression "objcObject_"c == cast(char[])field is not constant or does not evaluate to a bool
On 2012-01-24 13:26, Jacob Carlborg wrote:
> On 2012-01-24 09:43, Robert Lumley wrote:
>>
>> hi all :) i'm new to D and i'm trying to get step to compile on the Mac.
>> below is the template that gives the error:
>> dstep/internal/Reflection.d:205:0 expression "objcObject_"c ==
>> cast(char[])field is not constant or does not evaluate to a bool
>>
>> private template hasFieldImpl (T, string field, size_t i)
>> {
>> static if (T.tupleof.length == i)
>> const hasFieldImpl = false;
>>
>> else static if (T.tupleof[i].stringof[1 + T.stringof.length + 2 .. $] ==
>> field)
>> const hasFieldImpl = true;
>>
>> else
>> const hasFieldImpl = hasFieldImpl!(T, field, i + 1); }
>>
>> there error is on the line else static..
>>
>> thanks very much
>
> I don't know if you're using a D1 or D2 compiler but that project is for
> D1. But I have basically abandoned that project in favor of:
>
> http://michelf.com/projects/d-objc/

If you're interested in only that file it's available here as well and 
should be working both with D1 and D2:

https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d

-- 
/Jacob Carlborg
Top | Discussion index | About this forum | D home