On 06.03.2015 11:30, Julian Foad wrote:
> Branko Čibej wrote:
>> I'm also *very* scared of the
>> implicit, hidden qsort in the sorted.
> It's invoked only if you write "..._SORTED()" or "..._sorted()". That's 
> explicit and visible. What's so scary about that?

The term "sorted iteration" is ambiguous. In this case, it means "sort
the container, then iterate", which means it has a side effect. A more
common meaning is "iterate in sorted order, leaving the container
unchanged". See, for example, Python's sorted() generator adaptor.

It's much more visible and unambiguous to sort the container and then
iterate on the result. Iterations should not have side effects on the
container.

-- Brane

Reply via email to