I've just begun updating my code to work with 2.054 and noticed that quite a few things have been deprecated - some without a decent replacement. Could the phobos team not make a habit of this please?

Example:

Before:
----
foreach (file; listDir(".", "*.d") ~ listDir("./foo/", "*.c"))
{
    // Do something
}
----
After (sorry about the awkward indentation):
----
void doSomething(string file)
{
    // Do something
}
foreach (string file;
             filter!`endsWith(a.name,".d"))`(
                        dirEntries(".",SpanMode.depth))
{
   doSomething(file);
}

foreach (string file;
             filter!`endsWith(a.name,".c")`(
                        dirEntries("./foo/",SpanMode.depth))
{
   doSomething(file);
}
----
Also note that you can't use dirEntries() ~ dirEntries() or chain(dirEntries(), dirEntries()) as DirIterator is not a range.

If things in phobos are going to be deprecated, could you make sure that a decent replacement for *all* use cases is in place before hand?

It would also be nice to add into the documentation how to use the replacement functions to the same effect - it took me forever to figure out how to replace listDir with dirEntries.

--
Robert
http://octarineparrot.com/

Reply via email to