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

sybrandy sybrandy at gmail.com
Tue Nov 16 10:47:08 PST 2010


On 11/16/2010 01:30 PM, 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

This actually sounds interesting.  If I'm understanding things right, 
std.range.* would provide a range interface to specific libraries, such 
as regex.  So, in theory, there could be different interfaces to the 
same functionality.  E.g. std.range.regex, std.oo.regex, and 
std.proc.regex for a range interface, a OO interface, or a procedural 
interface.  Underneath, you could have the same core functionality, but 
people can access it in the way they feel most comfortable or that 
better fits the design of the program being written.  As new paradigms 
are invented, they can be added as well and be based on the existing 
interfaces.

Is this something we want to do?  Don't know.  I don't even know how 
feasible it is.  However, I do like the concept and if the goal is to 
make the language as friendly as possible, perhaps it should be looked 
into.  There's the chance that it will cause some confusion, but how 
much will actually occur?

The biggest issue I see is having certain libraries that don't fit well 
into all of the different paradigms.  E.g. a date library can have a 
nice OO interface and a nice procedural interface, but it doesn't make 
much sense to have a range interface.

Anyway, food for thought.

Casey


More information about the Digitalmars-d mailing list