[Issue 5710] cannot use delegates as parameters to non-global template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 6 15:34:43 PST 2011


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


Andrei Alexandrescu <andrei at metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei at metalanguage.com


--- Comment #4 from Andrei Alexandrescu <andrei at metalanguage.com> 2011-03-06 15:31:45 PST ---
(In reply to comment #3)
> (In reply to comment #2)
> > So is this an WONTFIX, then?
> 
> Unless there's an epiphany somewhere, yes. How would you suggest two hidden
> context pointers be handled? Is it clear that two context pointers are required
> (at least for this example)?
> 
> > Unfortunately it severely hurts my
> > std.parallelism design in some use cases, and a workaround for it would be a
> > significant PITA to implement, make the API uglier, and possibly be
> > inefficient.
> 
> I don't know enough about your design to offer help with that. Perhaps instead
> of an alias parameter, make fun explicitly a delegate?

There are several things here.

First, the compiler should figure out that add does not need a frame pointer
and consider it a static inner function, not a delegate.

Second, we need to agree that the reason you invoke is tied to the
implementation - you use the same pointer for the class and for the hidden
frame pointer, whereas of course there's no imposition to do so. The hidden
"this" parameter could go pretty much anywhere else.

One way or another we must fix this. Oddly, a number of similar uses do work
"by mistake", so at this moment we don't have a clear grasp on what
distinguishes cases that work from cases that don't.

We need to pursue this like a bloodhound and aggressively make as many cases as
possible work transparently. This is a major asset of D over virtually all
other languages.

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