New Article: My Experience Porting Python Dateutil's Date Parser to D

Ola Fosheim Grøstad via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Mar 10 01:17:58 PST 2016


Just pointing out the obvious:

For the simple iterators/generators that run on a non-changing 
source you can basically break it up into:

1. iterators without lookahead
2. iterators with lookahead

Which is basically the same issues you deal with when 
implementing a lexer.

Python-style iterators/generators is basically the former. That 
comes with one set of advantages, but no lookahead. But lookahead 
frequently have cost penalties. There are many tradeoffs. And 
those tradeoffs become rather clear when you consider factors 
like:

1. mutating iterators
2. the size of the object
3. copyable iterators
4. concurrency/thread safety
5. progress with high computational cost
6. high computational cost for the value
7. sources with latency
8. skip functionality
7. non-inlineable situations
8. exceptions
9. complex iterators (e.g. interpolation)
etc

There are massive tradeoffs even when writing iterators for 
really simple data-structures like the linked list. It all 
depends on what functionality one are looking for.

There is no best solution. It all depends on the application.



More information about the Digitalmars-d-announce mailing list