Splitter quiz / survey
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Apr 27 07:10:15 PDT 2009
Steven Schveighoffer wrote:
> On Mon, 27 Apr 2009 09:43:40 -0400, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> Jason House wrote:
>>> Before reading your post, I was going to say that I'd expect 4, would
>>> accept 1, and consider 2 or 3 to be buggy! Notice how under your new
>>> proposal everyone would still get the behavior wrong when reading the
>>> code.
>>
>> everyone posting heavily in thiss group != everyone
>>
>
> Not that I care, because I don't use phobos, but you haven't really
> presented any good argument that your method is the most intuitive except:
>
> 1. Some example of badly written code that outputs extra spaces (I don't
> consider this to be common).
No. I mentioned cases of corpora files that come from various sources.
> 2. Perl does it that way.
That is not my argument. Please reread. It's simply that I've found
split in Perl to do the right thing more often than not. So the presence
of Perl is irrelevant, it could have been "a split function that I used..."
> The way I see it is: when I see a function named "splitter", I think the
> function splits a string based on identified token separators. If you
> don't think of it that way, fine, you have every right to design Phobos
> however you want, despite the fact that 100% of respondants surveyed (so
> far) don't agree with your intuition.
>
> I have never thought of a list of tokens with terminators vs.
> separators. I think what you should have as an option to split is to be
> able to ignore leading or trailing empty items, not "seperator is really
> terminator" enums, which would require a paragraph of explanation.
I guess we could make a good decision based on the reusability of the
enum for other pieces of functionality. That suggests that "noTrailing"
and "noLeading" may find more uses.
Andrei
More information about the Digitalmars-d
mailing list