digitalmars.D.learn - cannot evalute mixin(uuid("bla")) at compile time
- Sam Hu (10/10) Aug 03 2010 Base on D1:
- Gareth Charnock (6/16) Aug 03 2010 I'm not to sure what uuid(string) does but check that:
- Richard Webb (4/4) Aug 03 2010 The Juno library has a 'uuid' that works like that, and the posted examp...
- Sam Hu (13/18) Aug 03 2010 Thank you both for the reply.Sorry for the lack of the signature of uuid...
- Steven Schveighoffer (4/25) Aug 04 2010 In d2, strings are represented by immutable(char)[]. Change uuid to
- Richard Webb (14/14) Aug 04 2010 Dwin uses Tango and so only works in D1 anyway, so i don't know if thats...
- Steven Schveighoffer (9/27) Aug 04 2010 All I'm saying is that is what the error message is saying "you're tryin...
- Philippe Sigaud (8/18) Aug 04 2010 Isn't that the trick used to test for infinite ranges? Infinite ranges a...
- Steven Schveighoffer (4/29) Aug 04 2010 Hm..., then shouldn't that be is(typeof(...))?
- Philippe Sigaud (3/10) Aug 04 2010 But char[1 + ...] is already a type, no? I thought typeof() was to extra...
- Steven Schveighoffer (4/19) Aug 04 2010 Yes, you are right, I'll just shut up now :)
- Richard Webb (3/3) Aug 04 2010 I don't have a minimal example, but i have found that the error only occ...
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
Aug 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, SamI'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?
Aug 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.
Aug 03 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.
Aug 03 2010
On Tue, 03 Aug 2010 21:04:26 -0400, Sam Hu <samhudotsamhu gmail.com> wrote:Richard Webb Wrote:In d2, strings are represented by immutable(char)[]. Change uuid to return and accept string (and fix any resulting bugs). -SteveThe 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.
Aug 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.
Aug 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
Aug 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 PhobosIsn'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. Philippecode 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.
Aug 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:Hm..., then shouldn't that be is(typeof(...))? -SteveOn 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 PhobosIsn'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.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.
Aug 04 2010
On Wed, Aug 4, 2010 at 22:00, Steven Schveighoffer <schveiguy yahoo.com>wrote:But char[1 + ...] is already a type, no? I thought typeof() was to extract type from an expression?code i'm not sure what the is(char[1 + Range.empty]))Hm..., then shouldn't that be is(typeof(...))?
Aug 04 2010
On Wed, 04 Aug 2010 17:31:30 -0400, Philippe Sigaud <philippe.sigaud gmail.com> wrote:On Wed, Aug 4, 2010 at 22:00, Steven Schveighoffer <schveiguy yahoo.com>wrote:Yes, you are right, I'll just shut up now :) -SteveBut char[1 + ...] is already a type, no? I thought typeof() was to extract type from an expression?code i'm not sure what the is(char[1 + Range.empty]))Hm..., then shouldn't that be is(typeof(...))?
Aug 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.
Aug 04 2010