[Issue 5359] std.traits : isDelegate returns false on a delegate

2013-03-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5359


Andrej Mitrovic andrej.mitrov...@gmail.com changed:

   What|Removed |Added

   Keywords||pull


--- Comment #5 from Andrej Mitrovic andrej.mitrov...@gmail.com 2013-03-08 
13:26:36 PST ---
https://github.com/D-Programming-Language/phobos/pull/1192

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5359] std.traits : isDelegate returns false on a delegate

2013-02-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5359



--- Comment #4 from Andrej Mitrovic andrej.mitrov...@gmail.com 2013-02-24 
16:24:20 PST ---
The real issue here was that isDelegate should have only accepted types, IOW
this should have been a compile-time error not a runtime one.

Fixed with https://github.com/D-Programming-Language/phobos/pull/1164

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5359] std.traits : isDelegate returns false on a delegate

2011-01-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5359


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||and...@metalanguage.com
 AssignedTo|nob...@puremagic.com|and...@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5359] std.traits : isDelegate returns false on a delegate

2010-12-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5359


Max Samukha samu...@voliacable.com changed:

   What|Removed |Added

 CC||samu...@voliacable.com


--- Comment #2 from Max Samukha samu...@voliacable.com 2010-12-20 04:28:28 
PST ---
I am sure that using homonym templates for testing types and expressions is a
bad idea. It results in some syntactic compression but at the same time brings
lots of confusion. There should be two distinct templates. Something like this:

template isExpression(alias expression)
{
enum isExpression = is(typeof(expression));
}

template isDelegate(alias expression) if (isExpression!expression)
{
enum isDelegate = isDelegateType!(typeof(expression));
}

template isDelegateType(T)
{
static enum isDelegateType = is(T == delegate);
}

template isFunctionPointer(alias expression) if (isExpression!expression)
{
enum isFunctionPointer = isFunctionPointerType!(typeof(expression));
}

template isFunctionPointerType(T)
{
static if (__traits(compiles, *T.init))
enum isFunctionPointerType = isFunctionType!(typeof((*T.init)));
else
enum isFunctionPointerType = false;
}

template isFunctionType(T)
{
enum isFunctionType = is(T == function);
}

unittest
{
alias void delegate() Dg;
Dg dg;
alias void function() Fn;
Fn fn;

static void foo()
{
}

static assert(isDelegate!dg);
static assert(isDelegateType!Dg);
static assert(!__traits(compiles, isDelegate!Dg));
static assert(!isDelegateType!Fn);

static assert(isFunctionPointer!fn);
static assert(!__traits(compiles, isFunctionPointer!Fn));
static assert(!isFunctionType!Fn);

static assert(isFunctionPointerType!Fn);
static assert(!isFunctionPointerType!Dg);

static assert(isFunctionType!(typeof(*foo)));
static assert(!isFunctionType!Fn);
static assert(!isFunctionType!Dg);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---