Jonathan M Davis , dans le message (digitalmars.D:174310), a écrit :
IMO, the behavior should be this: when trying to call the template with
a argument that is an enum type based on string, the compiler should try
to instanciate the template for this enum type, and isSomeString should
fail.
Le 04/08/2012 23:09, Jonathan M Davis a écrit :
At present (though it didn't used to work this way until about 4 months ago -
the change is in 2.060), a number of std.traits templates - including
isSomeString - evaluate to false for enums. So,
enum E : string { a = hello }
static
Le 05/08/2012 14:38, Christophe Travert a écrit :
Jonathan M Davis , dans le message (digitalmars.D:174267), a écrit :
On Saturday, August 04, 2012 15:22:34 Jonathan M Davis wrote:
On Sunday, August 05, 2012 00:15:02 Timon Gehr wrote:
T fun(T)(T arg) if(isSomeString!arg){
return
Andrej Mitrovic , dans le message (digitalmars.D:174259), a écrit :
On 8/4/12, Jonathan M Davis jmdavisp...@gmx.com wrote:
snip
I agree with you. isSomeString!T predicate failing maybe isn't as
serious as !isSomeString!T passing and ending up with wrong results.
At the very least this
Jonathan M Davis , dans le message (digitalmars.D:174267), a écrit :
On Saturday, August 04, 2012 15:22:34 Jonathan M Davis wrote:
On Sunday, August 05, 2012 00:15:02 Timon Gehr wrote:
T fun(T)(T arg) if(isSomeString!arg){
return arg~arg[0];
}
IMO, the behavior should be this:
On Sunday, August 05, 2012 12:38:56 Christophe Travert wrote:
Jonathan M Davis , dans le message (digitalmars.D:174267), a écrit :
On Saturday, August 04, 2012 15:22:34 Jonathan M Davis wrote:
On Sunday, August 05, 2012 00:15:02 Timon Gehr wrote:
T fun(T)(T arg) if(isSomeString!arg){
At present (though it didn't used to work this way until about 4 months ago -
the change is in 2.060), a number of std.traits templates - including
isSomeString - evaluate to false for enums. So,
enum E : string { a = hello }
static assert(isSomeString!(E.a));
will fail. This is in spite of
On Saturday, August 04, 2012 14:09:29 Jonathan M Davis wrote:
I think that the change to std.traits was a big mistake and will probably
file it as a regression, but I thought that I should get other people's
thoughts on this.
http://d.puremagic.com/issues/show_bug.cgi?id=8508
- Jonathan m
On 8/4/12, Jonathan M Davis jmdavisp...@gmx.com wrote:
snip
I agree with you. isSomeString!T predicate failing maybe isn't as
serious as !isSomeString!T passing and ending up with wrong results.
At the very least this should have been discussed about before the
change.
And why should a template
On 08/04/2012 11:09 PM, Jonathan M Davis wrote:
I agree that an enum's base type should not implicitly convert to the enum
type, since that would mean that you could have an invalid enum value, but I
see no problem with enums implicitly converted to their base type.
Well, there is a problem:
On Sunday, August 05, 2012 00:15:02 Timon Gehr wrote:
On 08/04/2012 11:09 PM, Jonathan M Davis wrote:
I agree that an enum's base type should not implicitly convert to the enum
type, since that would mean that you could have an invalid enum value, but
I see no problem with enums implicitly
On Saturday, August 04, 2012 15:22:34 Jonathan M Davis wrote:
On Sunday, August 05, 2012 00:15:02 Timon Gehr wrote:
T fun(T)(T arg) if(isSomeString!arg){
return arg~arg[0];
}
Though honestly, I'd argue that the compiler should treat arg ~ arg[0] as
being string rather than the
On Saturday, 4 August 2012 at 21:09:40 UTC, Jonathan M Davis
wrote:
I think that the change to std.traits was a big mistake and
will probably file it as a regression
I don't know what the right answer here is, but if you do end up
reverting those changes, be sure to change std.conv.to too so
On Sunday, August 05, 2012 05:40:40 Adam D. Ruppe wrote:
On Saturday, 4 August 2012 at 21:09:40 UTC, Jonathan M Davis
wrote:
I think that the change to std.traits was a big mistake and
will probably file it as a regression
I don't know what the right answer here is, but if you do end up
14 matches
Mail list logo