ClojureScript

clojure.string/split on empty regex includes empty string in results

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

In ClojureScript (clojure.string/split "abc" #"") yields ["" "a" "b" "c"] while in Clojure it yields ["a" "b" "c"]

It might be the case that this was done in https://github.com/clojure/clojurescript/commit/bf22dcca2e858811c8553ca9037e34a05b642121 to specifically match the behavior of an older version of Java (See CLJ-1312).

Given that Clojure / Java now produces a different behavior, if the only rationale for this was to make it match Clojure, then perhaps ClojureScript should also change? (If nothing else, for alignment with Clojure).

(I have no good answer regarding the fact that this would be a breaking change, but logging a ticket here for discussion regardless.)

Activity

Hide
David Nolen added a comment -

I think this one is probably ok.

Show
David Nolen added a comment - I think this one is probably ok.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: