[phobos] std.array.ilength

Jonathan M Davis jmdavisProg at gmx.com
Thu Feb 17 22:26:32 PST 2011


On Thursday 17 February 2011 22:13:24 Walter Bright wrote:
> I agree with Andrei.
> 
> My more general concern is that if we pump up Phobos with lots of little
> functions and aliases, we get a very large but not very useful library.
> We also increase the "cognitive load" of anyone attempting to understand
> standard D code.
> 
> When a standard library feature consists of 3 lines of trivial
> implementation, and 8 lines of documentation, that's a red flag to me
> that it shouldn't be in the library.
> 
> I'd really like to see library modules with small api's and large depth
> to them, like an XML parser.

That's also an excellent example of code that you don't usually want to write 
yourself if you don't have to - which would be another key feature that standard 
library code should be aiming for. Sure, there's some trivial stuff that gets 
used all over the place that would be easy for people to write themselves but 
should be in the standard library simply because it's used so much, but in 
general, the standard library should be aiming to solve problems that are not 
only common but which are not the sort of thing that you want to be implementing 
yourself. An XML parser is a prime example of that. The e-mail address 
validation code is probably a good example as well, though it wouldn't be used 
as much. Something like ilength can be implemented and used by anyone in their 
own code fairly easily if they really want it.

- Jonathan M Davis


More information about the phobos mailing list