Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added String.split_by, which uses a string delimiter (issue #1399) #1434

Merged
merged 1 commit into from
Nov 23, 2016

Conversation

enigma
Copy link
Contributor

@enigma enigma commented Nov 22, 2016

The signature is almost the same as String.split, we don't have any default value here. I'm not sure what'd make sense, \n, ' '?

There are some users of String.split in the stdlib and this can't be a drop-in replacement for those. If it's acceptable we can replace the current String.split uses with a Regex or move the current logic under another name (tokenize?).

@jemc
Copy link
Member

jemc commented Nov 23, 2016

We discussed this on the sync call.

The favored course of action is to accept this PR as-is, then later refactor to use type parameter inference (#1184) and specialisation (#1410) once those two features are implemented, so that the user can pass either String (for this new behaviour) or a ReadSeq[U32] (for the old behaviour of splitting by any of the given runes in the string). We might also consider allowing ReadSeq[String] as well. The combination of type parameter inference and specialisation means that we can have ergonomic usage of passing different types to the same method name as a zero-cost abstraction (instead of using a type union and unwrapping it - an abstraction with a cost).

@jemc jemc changed the title Add String.split_by that uses a string delimitator. (fix #1399) Add String.split_by that uses a string delimiter (issue #1399) Nov 23, 2016
@jemc jemc added the changelog - added Automatically add "Added" CHANGELOG entry on merge label Nov 23, 2016
@jemc jemc changed the title Add String.split_by that uses a string delimiter (issue #1399) Added String.split_by, which uses a string delimiter (issue #1399) Nov 23, 2016
@jemc jemc merged commit f566596 into ponylang:master Nov 23, 2016
ponylang-main added a commit that referenced this pull request Nov 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - added Automatically add "Added" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants