logoalt Hacker News

matheusmoreiralast Wednesday at 10:45 PM1 replyview on HN

> sequences are a band-aid over the lack of real iterator protocol

Wouldn't it be better to solve that problem? Proper generalized iteration with generators is just semicoroutines which can be implemented by swapping around stack pointers with zero copying. Should be competitive performance wise.


Replies

BoingBoomTschaklast Wednesday at 11:30 PM

As linked, the extensible sequence protocol (https://shinmera.com/docs/trivial-extensible-sequences/) already exists and is quite workable. The problem is that it's not supported enough, both by implementations (CCL missing, for example) and the entire ecosystem.

In the end, it's simpler to stay with boring, ANSI compliant solutions well optimized by compilers.

show 2 replies