Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
February 14, 2013 [Issue 9511] New: [enh] overloading on attributes | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9511 Summary: [enh] overloading on attributes Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: code@dawg.eu --- Comment #0 from Martin Nowak <code@dawg.eu> 2013-02-14 07:28:44 PST --- void foo() @safe { } void foo() nothrow { } void bar() @safe { foo(); } void bar() nothrow { foo(); } ---- This currently fails, because foo() is said to match both functions, but at the same time it is not an error to declare the overloads. The enhancement is to use attribute sets to resolve overloads. - The attribute set of the caller must be a subset of the callee. - The attribute sets of overloads must be disjoint if they have the same signature otherwise. ---- Some C++ AMP work has been done on this topic for restrict overloading. http://blogs.msdn.com/b/nativeconcurrency/archive/2012/03/29/function-overloading-with-restrict-in-c-amp.aspx -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 14, 2013 [Issue 9511] [enh] overloading on attributes | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9511 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmx.com --- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2013-02-14 10:21:30 PST --- I don't think that it's going to work to overload on any of these attributes. They're inferred for templated functions, which means that the functions being used within a function must have their @safety, purety, and nothrow-ity determined before they're determined for the function itself. So, you can't reasonably determine an overload of nothrow, @safe, or pure based on the caller. It has to be based on the arguments (which is _always_ how function overloading is determined). Rather, it would be better to make it so that overloads with the same parameters are illegal. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 14, 2013 [Issue 9511] [enh] overloading on attributes | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9511 --- Comment #2 from Martin Nowak <code@dawg.eu> 2013-02-14 13:37:05 PST --- > They're inferred for templated functions Right, I didn't thought of inference. But couldn't it still work with the non-inferred original type. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 14, 2013 [Issue 9511] [enh] overloading on attributes | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9511 --- Comment #3 from Martin Nowak <code@dawg.eu> 2013-02-14 13:40:26 PST --- > Rather, it would be better to make it so that overloads with the same parameters are illegal. Yes, that would be one solution, but I do think this could come in handy with UDA. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 15, 2013 [Issue 9511] [enh] overloading on attributes | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9511 --- Comment #4 from Martin Nowak <code@dawg.eu> 2013-02-14 18:11:47 PST --- Sometimes tag dispatching is used for the same purpose but it's not automated and definitely looses covariance. http://www.boost.org/community/generic_programming.html#tag_dispatching -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 08, 2013 [Issue 9511] [enh] overloading on attributes | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9511 --- Comment #5 from Martin Nowak <code@dawg.eu> 2013-04-08 15:06:44 PDT --- Jacob Carlborg and Andrei found the talk/article I was searching when I opened this enhancement. http://www.artima.com/cppsource/codefeaturesP.html It was mentioned here while talking about using UDA to guarantee non-allocating functions. http://forum.dlang.org/post/kjun26$2h00$1@digitalmars.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation