[Issue 5838] New: splitter and split names

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 12 17:22:42 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5838

           Summary: splitter and split names
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-04-12 17:18:57 PDT ---
>From benchmarks I've seen that std.array.splitter() is often more efficient
than std.array.split(), probably because splitter doesn't allocate memory for
the array.

Python programmers (and maybe other programmers) are used to use split(),
despite often splitter() is enough for their purposes.

The "splitter" name is longer than "split", but it's better to suggest D
programmers (and D programmes coming from Python) to use splitter() on default
instead of split().

So I suggest to give a shorter name to the lazy generator, and a longer name to
the function that returns an array. This is also more aligned to the naming in
std.algorithm where the short function names (like map and filter) are for the
lazy versions.

In bug 5756 I have suggested to add amap/afilter that approximately mean
array(map())/array(filter()). So the lazy splitter may be named just "split"
and the one that generates an array (that's similar to array(split())) may be
named "asplit" (if you want the prefix "a" may also be seen as the prefix of
the "aeger" word, instead of "array").

So my renaming suggestions are:

"split()" ==> "asplit()"
"splitter()" ==> "split()"

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list