[dmd-beta] D 1.075 and 2.060 betas 2
Andrei Alexandrescu
andrei at erdani.com
Mon Jul 30 09:30:10 PDT 2012
On 7/30/12 12:25 PM, kenji hara wrote:
> Unfortunately no. 'static nested struct' never have any frame pointers, so
>
> auto map(alias pred, Range)(Range r) {
> static struct Result {
> .. auto front() { return pred(...); }
> }
> }
>
> if pred is a nested function and requires its frame pointer to call
> it, Result cannot access it.
Got it. So is it correct to say that global structs templated with alias
sometimes save their frame pointers, sometimes not? If so, could you
please give a few more details on how that choice is made?
>> Longer term, it has become obvious to me that we need a clear and simple
>> mechanism for a function to save another function passed by alias, even if
>> that function holds state. That must happen regardless of interaction with
>> Voldemort types. We must have a mean do e.g. define a scope delegate that
>> holds the alias function and is able to call it. This has been a
>> long-standing problem that we've avoided in limited cases by relying on the
>> built-in frame pointer.
>
> The fundamental problem is the same as this.
>
> Issue 5710 - cannot use delegates as parameters to non-global template
> http://d.puremagic.com/issues/show_bug.cgi?id=5710
It would be quite a bummer if we can't address this limitation somehow.
Andrei
More information about the dmd-beta
mailing list