Feature Request: Change the delegate type to void[] data insteadofvoid*ptr.

downs default_357-line at yahoo.de
Thu Oct 4 10:08:49 PDT 2007


BCS wrote:
> Reply to Downs,
> 
>> BCS wrote:
>>
>>> Fun
>>> Bar.opApply  <<<<<
>>> Fun.foreachBody_1
>>
>> Again, you're missing something.
>> The void[] data property I'm proposing does not contain the complete
>> stack of the delegate. Since part of that stack (the delegate's)
>> doesn't even EXIST when the delegate is created, this would be rather
>> pointless. Instead, data references the stack area _outside_ of the
>> delegate that the delegate uses. So in this case, that would be Fun,
>> directly followed by its foreach body; two parts of the stack which
>> indeed form a continuous area. I hope that clears things up.
>> --downs
> 
> In between the Fun frame and the foreach frame is the opApply frame (or
> several frames). If you keep nesting function and passing delegate to
> arbitrary code to be called deeper in the stack, sooner or later, you
> get a gap of unknown size.
> 
> 
That is correct.
And since the void[] data and the immediate stack space of the function
don't need to have any direct relationship, it isn't a problem.
The stack space of the function is accessed via the SP or an equivalent
register. The outer stack area is accessed via (currently) void *ptr or
(proposed) void[] data. The two are separate areas. I don't see the problem.

 --downs



More information about the Digitalmars-d mailing list