Lots of low hanging fruit in Phobos

Peter Alexander peter.alexander.au at gmail.com
Sun Mar 9 04:35:52 PDT 2014


On Sunday, 9 March 2014 at 11:17:14 UTC, Tobias Pankrath wrote:
> On Sunday, 9 March 2014 at 11:00:13 UTC, Peter Alexander wrote:
>> On Sunday, 9 March 2014 at 10:30:37 UTC, bearophile wrote:
>>> w0rp:
>>>
>>>>> 3. Give up on maximum performance (fiber-based coroutine 
>>>>> range)
>>>>
>>>> I think that's what I would go for.
>>>
>>> Yet there's no need for that. You can have your pie and eat 
>>> it too, with a small cost. D can rewrite code that contains a 
>>> yield in an efficient finite state machine (this is what 
>>> ShedSkin compiler for Python does, and perhaps the C# 
>>> compiler does the same).
>>
>> How does this handle recursive generators, e.g. like you would 
>> see with a depth-first tree traversal? The "state" in this 
>> case is a call stack. How is the memory allocated for the 
>> stack?
>
> The generators mentioned are stack-less. You'd need to maintain 
> the stack yourself.

That's unfortunate. I find that non-recursive generators are 
pretty easy to write as ranges anyway :-/



More information about the Digitalmars-d mailing list