Jump to page: 1 2
Thread overview
cannot evalute mixin(uuid("bla")) at compile time
Aug 03, 2010
Sam Hu
Aug 03, 2010
Gareth Charnock
Aug 03, 2010
Richard Webb
Aug 04, 2010
Sam Hu
Aug 04, 2010
Richard Webb
Aug 04, 2010
Philippe Sigaud
Aug 04, 2010
Philippe Sigaud
Aug 04, 2010
Richard Webb
August 03, 2010
Base on D1:
interface IADsPropertyEntry : IDispatch {
  mixin(uuid("05792c8e-941f-11d0-8529-00c04fd8d503"));
  ...
Error when compile:
argument to mixin must be a string,not mixin(uuid("05792c8e-941f-11d0-8529-00c04fd8d503"))
cannot evaluate uuid("05792c8e-941f-11d0-8529-00c04fd8d503") at compile time

What's the problem and how to solve it?Thanks for your help in advance.

Regards,
Sam
August 03, 2010
On 03/08/10 15:19, Sam Hu wrote:
> Base on D1:
> interface IADsPropertyEntry : IDispatch {
>    mixin(uuid("05792c8e-941f-11d0-8529-00c04fd8d503"));
>    ...
> Error when compile:
> argument to mixin must be a string,not mixin(uuid("05792c8e-941f-11d0-8529-00c04fd8d503"))
> cannot evaluate uuid("05792c8e-941f-11d0-8529-00c04fd8d503") at compile time
>
> What's the problem and how to solve it?Thanks for your help in advance.
>
> Regards,
> Sam

I'm not to sure what uuid(string) does but check that:
1) It can be evaluated at compile time and
2) It returns a string.

Perhaps post the source of uuid (or at least the signature) so we can work out why it can't be evaluated at compile time?
August 03, 2010
The Juno library has a 'uuid' that works like that, and the posted example seems to build ok here using DMD 1.062.

Theres also a Tango version of the same code in the dwin library, but i haven't tried that for ages.
August 04, 2010
Richard Webb Wrote:

> The Juno library has a 'uuid' that works like that, and the posted example seems to build ok here using DMD 1.062.
> 
> Theres also a Tango version of the same code in the dwin library, but i haven't tried that for ages.
Thank you both for the reply.Sorry for the lack of the signature of uuid.Here they are:
char[] uuid(char[] g)
{
  ...
}


char[] uuid(char[] type, char[] g)
{
   ...
}
Richard:Yes,you is right.This is from dwin on which I tried to work out for the latest tango.Btw,have you got a workable version of juno for current D2?I tried several times but finally gave up.
August 04, 2010
On Tue, 03 Aug 2010 21:04:26 -0400, Sam Hu <samhudotsamhu@gmail.com> wrote:

> Richard Webb Wrote:
>
>> The Juno library has a 'uuid' that works like that, and the posted example seems
>> to build ok here using DMD 1.062.
>>
>> Theres also a Tango version of the same code in the dwin library, but i haven't
>> tried that for ages.
> Thank you both for the reply.Sorry for the lack of the signature of uuid.Here they are:
> char[] uuid(char[] g)
> {
>   ...
> }
> char[] uuid(char[] type, char[] g)
> {
>    ...
> }
> Richard:Yes,you is right.This is from dwin on which I tried to work out for the latest tango.Btw,have you got a workable version of juno for current D2?I tried several times but finally gave up.

In d2, strings are represented by immutable(char)[].  Change uuid to return and accept string (and fix any resulting bugs).

-Steve
August 04, 2010
Dwin uses Tango and so only works in D1 anyway, so i don't know if thats the problem (Juno uses string already, and i've used that ok in D1 and D2).

I've managed to get Juno working with a recent D2 before, but with the latest SVN version i get:

///////////////////////////////////////////////
phobos\std\range.d(645): Error: cannot evaluate empty((const(immutable(char)[])))
at compile time

phobos\std\range.d(645): Error: Integer constant expression expected instead of
cast(uint)(1 + cast(int)empty((const(immutable(char)[]))))
///////////////////////////////////////////////

I haven't worked out whats causing the problem yet, though looking at the Phobos code i'm not sure what the

       is(char[1 + Range.empty]))

is supposed to be doing.
August 04, 2010
On Wed, 04 Aug 2010 08:35:18 -0400, Richard Webb <webby@beardmouse.org.uk> wrote:

> Dwin uses Tango and so only works in D1 anyway, so i don't know if thats the
> problem (Juno uses string already, and i've used that ok in D1 and D2).

All I'm saying is that is what the error message is saying "you're trying to mixin something that's not a string.  It needs to be string"

Other than that, I'm not sure how to make dwin or juno work with a proper string type.

>
> I've managed to get Juno working with a recent D2 before, but with the latest SVN
> version i get:
>
> ///////////////////////////////////////////////
> phobos\std\range.d(645): Error: cannot evaluate empty((const(immutable(char)[])))
> at compile time
>
> phobos\std\range.d(645): Error: Integer constant expression expected instead of
> cast(uint)(1 + cast(int)empty((const(immutable(char)[]))))
> ///////////////////////////////////////////////
>
> I haven't worked out whats causing the problem yet, though looking at the Phobos
> code i'm not sure what the
>
>        is(char[1 + Range.empty]))

Not sure either, but empty called on a string should be evaluatable at compile time.  You should file a bug with a minimal example.

-STeve
August 04, 2010
On Wed, Aug 4, 2010 at 14:48, Steven Schveighoffer <schveiguy@yahoo.com>wrote:

> On Wed, 04 Aug 2010 08:35:18 -0400, Richard Webb <webby@beardmouse.org.uk> wrote:
>


>     I haven't worked out whats causing the problem yet, though looking at
> the Phobos
>
>> code i'm not sure what the
>>
>>       is(char[1 + Range.empty]))
>>
>
> Not sure either, but empty called on a string should be evaluatable at compile time.  You should file a bug with a minimal example.
>

Isn't that the trick used to test for infinite ranges? Infinite ranges are
defined to have an  'enum bool empty = false' member. So, for an infinite
range, 1+Range.empty is a compile-time expression that can be used as
dimension for a static array.
Else, .empty is a function and I suppose the is() returns false.

Or something like that, anyway.


Philippe


August 04, 2010
On Wed, 04 Aug 2010 14:52:14 -0400, Philippe Sigaud <philippe.sigaud@gmail.com> wrote:

> On Wed, Aug 4, 2010 at 14:48, Steven Schveighoffer <schveiguy@yahoo.com>wrote:
>
>> On Wed, 04 Aug 2010 08:35:18 -0400, Richard Webb <webby@beardmouse.org.uk>
>> wrote:
>>
>
>
>>     I haven't worked out whats causing the problem yet, though looking at
>> the Phobos
>>
>>> code i'm not sure what the
>>>
>>>       is(char[1 + Range.empty]))
>>>
>>
>> Not sure either, but empty called on a string should be evaluatable at
>> compile time.  You should file a bug with a minimal example.
>>
>
> Isn't that the trick used to test for infinite ranges? Infinite ranges are
> defined to have an  'enum bool empty = false' member. So, for an infinite
> range, 1+Range.empty is a compile-time expression that can be used as
> dimension for a static array.
> Else, .empty is a function and I suppose the is() returns false.
>
> Or something like that, anyway.

Hm..., then shouldn't that be is(typeof(...))?

-Steve
August 04, 2010
I don't have a minimal example, but i have found that the error only occurs with the most recent version of std.algorithm -> the current SVN version of phobos with the previous revision of algorithm compiles ok.
« First   ‹ Prev
1 2