[Issue 10772] std.regex.splitter generates spurious empty elements with empty delimiter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 19 10:18:14 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=10772


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com


--- Comment #5 from monarchdodra at gmail.com 2013-12-19 10:18:12 PST ---
Arguably, 0-width splitting makes no sense: If it were to rigorously follow the
rules, then you'd simply end up with an infinite amount of leading tokens.
["", "T", "E", "S", "T", ""]
Makes no sense to me. Why is there an empty leading/trailing token, but none
between each letter?

This means that in regards to 0-length splitting, it should either be an
*error*, or have a *special behavior*

std.algorithm.split simply special cases to do what seems most useful (what is
documented by pearl, AFAIK). I think having regex do the same is most sensible.

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


More information about the Digitalmars-d-bugs mailing list