On 5/8/2014 2:20 PM, Andrei Alexandrescu wrote:
Some may be surprised that auto c = setExtension(a, b) doesn't actually just do
it. So changing a and/or b before using c would yield surprising result for
someone coming from a background of eager-string languages.
It's true that when I first encountered C#'s LINQ, I was surprised that it was
lazy.
It's also true that most of std.algorithm is lazy. Apart from coming up with a
new naming convention (and renaming algorithms in Phobos), I don't see any
obvious solution to what's lazy and what's not.
One possibility is to informally (i.e. in the documentation rather than the core
language spec) call something an 'algorithm' if it is lazy and 'function' if it
is eager.