Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions fusion/src/fusion/experimental/string.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this removal not break test cases?
🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, it did: https://github.com/ion-fusion/fusion-java/actions/runs/19654525460/job/56291878967?pr=351#step:5:57-60

You can test locally using the check target.

I recommend running ./gradlew clean release on each PR to ensure full build/test success.

'''
(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")
)
26 changes: 6 additions & 20 deletions fusion/src/fusion/string.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +181 to +182
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prose needs updating: the reference to FusionJavaRegexp is vestigial from Amazon. But also we don't need to give migration instructions since there's no current users of this public version of the language. (Any use inside Amazon would necessarily need to use an adaptation layer that would need to advise appropriately.)

The relevant regexp_split code is in this repository on the regexp branch, and the plan is to integrate it into the core. That's what we'd want to reference from here, it just doesn't exist yet.

So we should strip out most of this beyond the semantic clarification.

If you're interested in working on #159 (the regexp integration), please comment on that issue (or reach out on Discord) and ask me to sketch out the approach I have in mind.

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)
'''
Expand Down
Loading