std.regexp vs std.regex [Re: RegExp.find() now crippled]

Steven Schveighoffer schveiguy at yahoo.com
Tue Nov 16 11:05:22 PST 2010


On Tue, 16 Nov 2010 13:46:48 -0500, Steve Teale  
<steve.teale at britseyeview.com> wrote:

> Steven Schveighoffer Wrote:
>
>> On Tue, 16 Nov 2010 13:16:13 -0500, Steve Teale
>> <steve.teale at britseyeview.com> wrote:
>> >
>> > Andrei,
>> >
>> > Maybe it is time that the structure of the standard library became  
>> more
>> > generalized. At the moment we have std... and core...
>> >
>> > Perhaps we need another branch in the hierarchy, like ranges... Then
>> > there could be a std.range module that was the gateway into ranges...
>> > The library could then expand in an orderly fashion, with a wider  
>> range
>> > of users becoming responsible for the maintenance of of different
>> > branches against changes in the language, not against changes in  
>> fashion.
>> >
>> > Then you could have ranges.regex, that suits you, and the people who
>> > were happy with the status quo, could continue to use std.regexp,  
>> which
>> > should continue to behave like it did in DMD2.029 or whatever it was
>> > when I wrote my 'legacy' code.
>> >
>> > The current system, where modules of the library can get arbitrarily
>> > deprecated and at some point removed because they are unfashionable,  
>> is
>> > very unfriendly.
>> >
>> > I recognize that you are young, hyper-intelligent, and motivated  
>> toward
>> > fame. But there are other users, like me, who are older, but not  
>> senile,
>> > and have more conservative attitudes, including the desire to use code
>> > they wrote in the past at some point in the future.
>>
>> The standard library should not have something to please everyone.  If
>> there is 5 different styles to do the same thing, it will be a failure.
>>
>> Can you just copy std.regex from 2.029 and compile it in your project?
>> I.e. instead of phobos adding range branch for the new range style, you
>> add branch Teale for your style and copy what you like in there.  Then  
>> you
>> have what you want (may take a little effort on your part, but then you
>> control the results).
>>
>> Also, 2.029 is still available via download, you can still use it.
>>
>> -Steve
>
> Yes Steve, of course I can, but other much more popular languages like  
> for instance PHP seem to do OK with the suit-everyone style.

I don't object to having multiple styles to do things, I even maintain a  
library (dcollections) that is not even close to the style of  
std.container.  I just object to everything being included in the standard  
library.  The standard library should do things one way, and if you want  
something different, use an add-on library.

I'm guessing you are referring to php's pcre vs posix regex?  I think  
posix is marked as deprecated...

> I am just upset that code I put a lot of effort into gets broken because  
> somebody else does not like the style of the library.

Well, the library isn't finished.  As much as I understand your pain, I  
also don't think phobos should be write-only.  We should not be stuck with  
mistakes or designs of the past until we have stated the library is  
released, and then we can deal with backwards compatibility in a  
reasonable way.  Until then, you shouldn't expect everything to be set in  
stone.  Sorry if this is confusing or annoying.

That being said, if std.regexp is broken, I don't think it was  
intentional.  In fact, in the bug report, someone mentions a one-line fix,  
does that solve your problem?  AFAIK, regexp is not even deprecated yet,  
which means it should be supported.  I think Andrei said as much.

> Which should be preserved - style, or substance?

substance.  AFAIK, substance is preserved, or am I misunderstanding you?

-Steve


More information about the Digitalmars-d mailing list