Splitter quiz / survey -- PLEASE NO

downs default_357-line at yahoo.de
Mon Apr 27 10:19:07 PDT 2009


Andrei Alexandrescu wrote:
> bearophile wrote:
>> Andrei Alexandrescu:
>>> Splitter does what Perl's split does: 2.
>>
>> Perl has to die. This is Python:
> 
> This answer is wrong for a number of reasons. First comes the fallacy
> that if Perl "has to die", everything Perl did was wrong. Second comes
> the fallacy that if Python is overall better than Perl, everything it
> does is better than everything Perl does.
> 
>>>>> ",a,b,".split(",")
>> ['', 'a', 'b', '']
>>
>> My lazy xsplit too works like that. I strongly vote for (4).
> 
> Why? I'd be willing to change things no problem, but "perl must die,
> here's python" just doesn't seem to have much persuasive power.
> 
> 
> Andrei

It is my strong opinion that Perl did this wrong. Why? Because it quite strongly violates user expectations.

Please keep magic out of D as far as possible. If unavoidable, mark it with big warning signs. Magic is the *enemy* of comprehension.

Microsoft once experimented with tools that tried to predict what you wanted instead of what you _said_.

The result was *Clippy*. I don't need to tell you how that went.

FWIW: If I wanted to remove trailing spaces, I'd use the well-known .strip() function.



More information about the Digitalmars-d mailing list