digitalmars.D.bugs - [Issue 5359] New: std.traits : isDelegate returns false on a delegate
- d-bugmail puremagic.com (27/27) Dec 19 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5359
- d-bugmail puremagic.com (12/12) Dec 19 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5359
- d-bugmail puremagic.com (61/61) Dec 20 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5359
- d-bugmail puremagic.com (6/6) Dec 20 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5359
- d-bugmail puremagic.com (10/10) Jan 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5359
- d-bugmail puremagic.com (8/8) Feb 24 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5359
- d-bugmail puremagic.com (10/10) Mar 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5359
- d-bugmail puremagic.com (11/11) Mar 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5359
- d-bugmail puremagic.com (9/9) Mar 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5359
http://d.puremagic.com/issues/show_bug.cgi?id=5359 Summary: std.traits : isDelegate returns false on a delegate Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 14:49:57 PST --- import std.traits; import std.stdio : writeln; void main() { int delegate() dg; writeln(typeid(dg)); // "int delegate()" assert(isDelegate!(int delegate())); // ok assert(isSomeFunction!(dg)); // ok.. assert(isDelegate!(dg)); // fails } Huh? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 19 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5359 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com PST --- I believe that there are at least a couple of other open bugs on traits and delegates, so it would appear that traits are very broken for delegates right now. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 19 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5359 Max Samukha <samukha voliacable.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |samukha voliacable.com 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: -------
Dec 20 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5359 PST --- "static enum" should be replaced with "enum" in the example -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 20 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5359 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com AssignedTo|nobody puremagic.com |andrei metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5359 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: -------
Feb 24 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5359 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull 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: -------
Mar 08 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5359 Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/091a57650b5cd51cf0912fdee488d5c0730c7e06 Fixes Issue 5359 - isDelegate should work for types and expressions. https://github.com/D-Programming-Language/phobos/commit/28fad77612f8252658ced4989105271b4f3717a0 Issue 5359 - isDelegate should work for types and expressions. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5359 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 09 2013