std.path.setExt
Kapps via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 23 19:36:35 PDT 2015
On Tuesday, 23 June 2015 at 23:13:11 UTC, Mike wrote:
> `setExtensionLazy`
>
> Mike
I really don't like the Lazy suffix. Ignoring the issue of making
things somewhat uglier solely for the purpose of ambiguity, it
also leads to confusion regarding whether you should be invoking
foo or fooLazy. Is there a fooLazy for this, or is it just foo,
and why? Just because it was implemented before some arbitrary
point? The lazy approach should be strongly preferred and should
be the default; if the user wants the non-lazy version, they can
use .array. Plus, as mentioned, people will start thinking that
their own code should use this Lazy suffix which is likely
something we don't want to encourage.
The current setExt name has the same issues I mentioned above,
and it honestly is very odd to me to see setExt as well as
setExtension if we're not intending to slowly phase out
setExtension. The proposed withExtension indicates that it takes
in a range and returns a range with the modifications applied,
and I quite like it. I think that should be a trend for lazy
algorithms, or at least a way to disambiguate.
More information about the Digitalmars-d
mailing list