[Issue 4880] [patch] std.range.put does not handle output ranges implement via opDispatch; breaks on RefAppender

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 17 12:33:48 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4880



--- Comment #2 from Rob Jacques <sandford at jhu.edu> 2010-09-17 12:33:14 PDT ---
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: -------


More information about the Digitalmars-d-bugs mailing list