function literals cannot be class members

d coder dlang.coder at gmail.com
Fri Sep 23 03:10:02 PDT 2011


On Mon, Jul 18, 2011 at 8:18 PM, Andrei Alexandrescu <
SeeWebsiteForEmail at erdani.org> wrote:
[snip..]


> We need to keep this key strategic advantage. First off, the fact that this
> code isn't accepted:
>
>
> BinaryHeap!(uint[], function (a, b) {return a > b;}) heap;
>
> is a clear bug.
>
>
>  Worst case, BinaryHeap grows a branch which stores/calls a delegate
>> instead of a template parameter.
>>
>
> I'll discuss with Walter, but even without any language change we can
> define a special symbol that means "store this object inside". That symbol
> has nothing interesting about it, e.g.:
>
> /// Use this for comparators with state
> struct Dynamic(T) {}
>
> Heap!(uint[], Dynamic!(bool delegate(uint, uint))) myHeap;
>
> A better solution have us detect from the alias that we need to allocate
> storage for it in the Heap object.
>
>

Andrei

 Did you get a chance to take this up with Walter? I wanted to make sure
that we do not forget this issue altogether. Should I file this on Bugzilla?

Regards
- Puneet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110923/798a09b3/attachment.html>


More information about the Digitalmars-d mailing list