[Issue 7802] UFCS functions get lost when type is transmitted to template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 4 07:30:09 PDT 2012


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


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com


--- Comment #5 from Steven Schveighoffer <schveiguy at yahoo.com> 2012-04-04 07:30:43 PDT ---
I would suggest instead of using the instantiation scope, use the scope of the
defined type.  Then the notion of "LOCAL" templates is not needed.

For example, if struct S is defined in foo.d, and you instantiate template
function func in bar.d:

void func(T)(T t)
{
   t.baz();
}

and baz is not a member function, look it up from two scopes -- the template
definition scope (i.e. bar.d) and the scope where S is defined (i.e. foo.d). 
This means S's API, including UFCS, is identical no matter where you use it
from.  Prefer type definition scope over template definition scope, to keep the
type's API intact.

-- 
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