From aa7d6dc68ad3740e739a816c68e47a0a5fdd35f5 Mon Sep 17 00:00:00 2001 From: Chase Naples Date: Mon, 24 Nov 2025 19:46:39 -0500 Subject: [PATCH] Replace string_split impl with string_split_noregexp The string_split function was accidentally supporting regular expressions, which was unintended and conflicted with the design goal of having no dependency on the Java language or library. Changes: - Updated string_split to use SplitNoRegexpProc instead of SplitProc - Removed deprecation warnings from string_split documentation - Updated docs to clarify separator is not a regular expression - Removed string_split_noregexp from experimental/string module as it's no longer needed Fixes #349 --- fusion/src/fusion/experimental/string.fusion | 20 --------------- fusion/src/fusion/string.fusion | 26 +++++--------------- 2 files changed, 6 insertions(+), 40 deletions(-) diff --git a/fusion/src/fusion/experimental/string.fusion b/fusion/src/fusion/experimental/string.fusion index 06be0bcdf..f7d76ea55 100644 --- a/fusion/src/fusion/experimental/string.fusion +++ b/fusion/src/fusion/experimental/string.fusion @@ -74,24 +74,4 @@ Since Fusion doesn't define a specific implementation of strings, this procedure is not guaranteed to have better than O(_n_) time. ''' "dev.ionfusion.fusion.FusionString$IndexCodePointsProc") - - - (defpub_j string_split_noregexp - ''' - (string_split_noregexp string separator) - -Splits `string` into an immutable list of strings using `separator`. -Both arguments must be actual strings. - -Returns an empty list when `string` is an empty string. - -The `separator` is _not_ a regular expression; callers needing that feature -should use `regexp_split` from the [FusionJavaRegexp][] package, being careful -to adapt code to that method's different argument order, result type (sexp -instead of immutable list), and edge cases around leading matches. Test your -code thoroughly. - -[FusionJavaRegexp]: wiki:FusionJavaRegexp - ''' - "dev.ionfusion.fusion.FusionString$SplitNoRegexpProc") ) diff --git a/fusion/src/fusion/string.fusion b/fusion/src/fusion/string.fusion index c336550eb..8f40d9b55 100644 --- a/fusion/src/fusion/string.fusion +++ b/fusion/src/fusion/string.fusion @@ -178,29 +178,15 @@ Both arguments must be actual strings. Returns an empty list when `string` is an empty string. -**DEPRECATED** where `separator` is a regular expression. That behavior was -unintentional, and in conflict with this library's design goal to have no -dependency on the Java language or library. - - * Callers needing to split based on regular expressions should use - `regexp_split` from the [FusionJavaRegexp][] package, being careful to adapt code to that method's - different argument order, result type (sexp instead of immutable list), and - edge cases around leading matches. Test your code thoroughly. - * Callers needing separators that are escaped to avoid being regular - expressions should use [`string_split_noregexp`][ssn] until the regexp - behavior is removed from this procedure. For example, replace: - - (string_split txt "\\\\.") - - with: - - (require "/fusion/experimental/string") - (string_split_noregexp txt ".") +The `separator` is _not_ a regular expression; callers needing that feature +should use `regexp_split` from the [FusionJavaRegexp][] package, being careful +to adapt code to that method's different argument order, result type (sexp +instead of immutable list), and edge cases around leading matches. Test your +code thoroughly. [FusionJavaRegexp]: wiki:FusionJavaRegexp -[ssn]: fusion/experimental/string.html#string_split_noregexp ''' - (java_new "dev.ionfusion.fusion.FusionString$SplitProc")) + (java_new "dev.ionfusion.fusion.FusionString$SplitNoRegexpProc")) (define_values (string_starts_with) '''