digitalmars.D.bugs - [Issue 4880] New: [patch] std.range.put does not handle output ranges implement via opDispatch; breaks on RefAppender
- d-bugmail puremagic.com (27/27) Sep 17 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4880
- d-bugmail puremagic.com (13/13) Sep 17 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4880
- d-bugmail puremagic.com (16/16) Sep 17 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4880
- d-bugmail puremagic.com (10/10) Jan 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4880
- d-bugmail puremagic.com (11/11) Feb 14 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4880
http://d.puremagic.com/issues/show_bug.cgi?id=4880 Summary: [patch] std.range.put does not handle output ranges implement via opDispatch; breaks on RefAppender Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: sandford jhu.edu std.range.put does not correctly introspect types which implement put via opDispatch. This is fairly simple to fix by swapping hasMember out for a __traits compiles test. void put(R, E)(ref R r, E e) { + static if (__traits(compiles, {return R.init.put(E.init);}) ) - static if (hasMember!(R, "put") || - (isPointer!R && is(pointerTarget!R == struct) && - hasMember!(pointerTarget!R, "put"))) { -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 17 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4880 David Simcha <dsimcha yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dsimcha yahoo.com This is a rather problematic bug. If we use your patch, it will break when uniform function call syntax is fully implemented. I guess what we need is for hasMember to be less restrictive. It should include opDispatch, and while we're at it, pointers to structs. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 17 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4880 Well half of puts' functionality is to emulate uniform function call syntax for structs and classes: i.e. re-write put(r,e) into r.put(e). So I'd expect UFC to break put with or without this patch. I had thought of improving hasMembers (either the __traits or templated version) to support opDispatch, however, I do not think that it is possible. The problem is template constraints. Consider the highly synthetic example: void opDispatch(string name, T...) if( name.length == T.length ) {} Because the template constraint could be non-trivially dependent on something more than name there's no way to check if r.opDispatch!"put" is valid without actually evaluating r.put(e) (i.e. __traits(compiles,...)) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 17 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4880 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=4880 Rob Jacques <sandford jhu.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull I converted the patch into a pull request: https://github.com/D-Programming-Language/phobos/pull/433 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 14 2012