to!()() & leading/trailing whitespace

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Aug 16 18:49:05 PDT 2010


bearophile wrote:
> This post is about this enhancement request of mine that recently
> David Simcha has closed as wontfix: 
> http://d.puremagic.com/issues/show_bug.cgi?id=4165
[snip]
> Phobos functions are meant as the most simpler bricks, that you may
> compose to perform more complex operations: this is generally true
> and good, but Python shows that when two or few operations are
> frequently done attached to each other, it's good to put inside the
> std lib something the performs the composed thing in one go, because
> it helps chunk the code and makes the code shorter and more readable,
> and decreases the chance for bugs. When I read numbers from files I
> will need to use to!int(txt.strip()) often.

I don't feel very strongly about this (in particular e.g. I do allow 
leading whitespace for floating-point parsing).

My only problem is that sometimes people _don't_ want to ignore trailing 
whitespace, which becomes quite difficult. But then I guess that's a 
rare case.


Andrei


More information about the Digitalmars-d mailing list