[phobos] Deprecation of std.regexp

Jonathan M Davis jmdavisProg at gmx.com
Sun Jun 5 16:20:49 PDT 2011


On 2011-06-05 09:38, Dmitry Olshansky wrote:
> On 05.06.2011 12:13, Jonathan M Davis wrote:
> > On 2011-06-05 00:56, Brad Roberts wrote:
> >> On 6/5/2011 12:52 AM, Jonathan M Davis wrote:
> >>> It looks like std.regexp was marked in its documentation as deprecated
> >>> in 2.053. It was not actually deprecated (the deprecation modifier is
> >>> missing), but if it has indeed been deprecated (and std.regex has been
> >>> around for a while, so it's not exactly a surprise), then it needs to
> >>> actually be deprecated, and the rest of Phobos needs to be using
> >>> std.regex instead. I can easily deprecate the function (after all, all
> >>> you have to do is add deprecated: near the top of the file), but since
> >>> I've never used either of the regex modules, I'm ill-suited to convert
> >>> the rest of Phobos to use std.regex. So, I'd appreciate it if someone
> >>> who is actually familiar with the two modules would convert the rest
> >>> of Phobos to use std.regex sometime prior to the next release, and
> >>> then we can actually deprecate std.regexp. Worse comes to worst, I can
> >>> take a crack at it, but it would be much faster if someone who's
> >>> familiar with the regex modules did it.
> >>> 
> >>> Now, we may actually want to change std.regexp to "scheduled for
> >>> deprecation" rather than deprecated simply because there are other
> >>> functions in Phobos which take stuff from std.regexp but not std.regex
> >>> (such as the version of std.file.listdir which takes a RegExp) have not
> >>> yet been scheduled for deprecation, let alone deprecated, but
> >>> regardless, we need to change the rest of Phobos to use std.regex or we
> >>> won't be able to actually deprecate and remove std.regexp (well, I
> >>> suppose that we _could_ deprecate it as-is, but it seems to me to be a
> >>> bad idea to deprecate something when Phobos is still using it in its
> >>> API elsewhere).
> >>> 
> >>> - Jonathan M Davis
> >> 
> >> It was marked deprecated once (check out the blame history of the file),
> >> but that was reverted since commonly used modules still use it.  The
> >> effect would be that essentially every app would need to be compiled
> >> with -d, which is hardly useful.  Until phobos doesn't use it, no real
> >> deprecation can actually occur.
> > 
> > That's essentially my point. Someone needs to convert the rest of Phobos
> > so that it uses std.regex instead of std.regexp before we can properly
> > deprecate std.regexp (and given all of the stuff in Phobos which still
> > uses std.regexp, we should probably make it so that std.regexp is
> > _scheduled_ for deprecation rather than deprecated, but the changes
> > still need to be made). Simply marking std.regexp as deprecated in its
> > documentation isn't enough. I'm raising the issue so that someone who is
> > actually familiar with std.regexp and std.regex can do the conversion.
> 
> Looks like I'm the one best suited for this, since I have extensive
> experience with both modules and their internals.
> In fact, I'm doing GSOC project aimed at enhancing current std.regex,
> basically replacing implementation and extending interface quite a bit.
> Still changes going to be backwards compatible, so it's about time to
> switch all phobos to std.regex.
> I'll make a pull request soon.

Thanks! Remember that where possible, functions in Phobos' public API which 
would be affected by the change should have the old version kept temporarily 
as "scheduled for deprecation" in order to give people some time to convert 
over rather than immediately breaking their code. And if the old function is a 
template, then a pragma warning about the the change should be put inside it. 
You can look at what std.file is currently doing with functions scheduled for 
deprecation for examples. Don't worry too much about the exact messages. I can 
go and adjust them later. Just mark them as scheduled for deprecation.

The current plan is that anything which is deprecated should be scheduled for 
deprecation for about 6 months, deprecated for 6 months, and then removed. But 
std.regex has been around long enough that I suspect that we can accelerate 
that process a bit in this case.

In any case, thank you for taking the time to convert over Phobos to 
std.regex. Then we can finally move towards removing std.regexp.

- Jonathan M Davis


More information about the phobos mailing list