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

Breaking: remove String#tokenize core extension #39

Merged
merged 1 commit into from
Feb 15, 2022
Merged

Conversation

Narnach
Copy link
Owner

@Narnach Narnach commented Feb 15, 2022

This was deprecated in v0.4.0 (ee08d06) so it gets removed in the next major release, v0.5.0, which I intend to release soon.

To recap: please use Groupie.tokenize(string) instead of string.tokenize.

Why remove a core extension? 10 years ago (when I added it) they were more commonly accepted (we were still in the early days of Ruby). These days it's less common in the community to use core extensions, especially for trivial things.

Ruby is a language that allows amazing levels of expressiveness due to core extensions being foundational for domain specific languages, but the dark side is that when used poorly it only makes code harder to understand and debug.

This very example: the deprecated code makes it hard to understand where tokenize is implemented. Is it part of Ruby's core library? Is it part of a core extension library such as ActiveSupport? Is it part of one of the 200+ gems that a large project might have? You simply don't know unless you have a smart IDE that understands it for you, or you happen to be the engineer that added the library and thus knows about it (but your colleague is still dumbfounded).

In contrast, the new default makes it very explicit where the tokenize function comes from. Being able to understand and reason about code is something I've come to appreciate more after having jumped into multiple projects that other people had created and thus I was the one that lacked context where things came from.

This was deprecated in v0.4.0 so it gets removed in the next major
release, v0.5.0.

To recap: please use `Groupie.tokenize(string)` instead of
`string.tokenize`.
@Narnach Narnach merged commit b06f923 into stable Feb 15, 2022
@Narnach Narnach deleted the remove-core-ext branch February 15, 2022 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant