[phobos] isStringLike
Vladimir Panteleev via phobos
phobos at puremagic.com
Mon Oct 26 23:20:40 PDT 2015
On Monday, 26 October 2015 at 21:27:37 UTC, Walter Bright wrote:
> My recommendation was to remove the alias this in DirEntry that
> tried to turn it into a string. A DirEntry is not a wrapper for
> a string, in particular, it does not support range primitives,
> which is why the string functions failed when changed to have
> InputRange parameters. Adding range primitives to DirEntry
> would cause other weird problems, because DirEntry is
> fundamentally not a range (a range 'consumes' its data via
> popFront() which makes no sense for DirEntry).
>
> Yes, that breaks:
>
> DirEntry direntry;
> remove(direntry);
>
> which must be rewritten as:
>
> DirEntry direntry;
> remove(direntry.name);
>
> and we're not supposed to break existing code. But the
> alternative, which is redoing every template that accepts an
> InputRange, seems an awfully heavy burden.
DirEntry is not the only source of problems. For example, the
rangification also broke ae.utils.funopt, which also uses structs
with an alias this'd string.
http://blog.thecybershadow.net/2014/08/05/ae-utils-funopt/
More information about the phobos
mailing list