News for hackers. Stuff that matters.
Re:Responsible Monkeypatching in Ruby by joelbluminator on Friday August 27, 2021 @12:33PM (#28329822)
Here is a simple example. Ruby's start_with? method which is confusing because its bad grammar. So AS added an alias and called it starts_with? https://github.com/rails/rails/blob/main/activesupport/lib/a...

Why is this bad? Makes total sense to me. Now both forms work and hopefully it eventually makes it into the language like often happens. But until it does, why not monkey patch obvious mistakes?

Re:Responsible Monkeypatching in Ruby by Fire-Dragon-DoL on Friday August 27, 2021 @01:02PM (#28330269)
Because Ruby has been consistent: there is no method starting with S.

Array has `include?`, Regexp has `match?` and String has `match?` and `start_with?`.

This is consistent: there is no S.

Now when I'm in a codebase, depeneding on ActiveSupport and which parts of it are included, the consistency is now missing. Is it with S or without S?

And what methods DO have the S version and which one do not?

Re:Responsible Monkeypatching in Ruby by joelbluminator on Friday August 27, 2021 @01:27PM (#28330592)
It's a fair point about consistency but its still bad naming. AS accepts both so I don't see a problem. I do hope Ruby will eventually deprecate and rename it to includes? , starts_with? etc.