Earlier quoted context omitted.
Someone submitted it and people voted on it.
Quoted post unavailable.
There are tons of examples, with links to the code, I think it's fairly informative.
11–20 of 89 posts
File.read('input6.txt').chars.each_cons(4).find_index { _1.uniq == _1 } + 4This almost reads more like a list of cruft which should be removed from the stdlib (obviously not benchmark.rb though). For delegation it is probably better to use forwardable and be explicit about delegated methods--delegate.rb smells like it uses method_missing magic.
This almost reads more like a list of cruft which should be removed from the stdlib (obviously not benchmark.rb though). For delegation it is probably better to use forwardable and be explicit about delegated methods--delegate.rb smells like it uses method_missing magic.
I mean, no one's making you use this functionality, why should it be removed?
This article is kind of niche... My favourite Ruby delights are among others, methods provided by the Enumerable mixin https://rubyapi.org/3.1/o/enumerable . There's a pile of functionality there that helps with tedious tasks. E.g. here's a solution to this year's AOC challenge #6 using Enumerable's each_cons method: File.read('input6.txt').chars.each_cons(4).find_index { _1.uniq == _1 } + 4
This almost reads more like a list of cruft which should be removed from the stdlib (obviously not benchmark.rb though). For delegation it is probably better to use forwardable and be explicit about delegated methods--delegate.rb smells like it uses method_missing magic.
I mean, no one's making you use this functionality, why should it be removed?
If you're making a new programming language today, the standard library is a place where you should think very carefully about everything you add. Every programmer learning the language will have to be familiar with the standard library, so keeping it small is good. But too small, and programmers will always have to reach for third-party packages without maintenance or stability guarantees. For example, you don't want to have to choose among 5 different libraries to write and run unit tests; the language should define that and it should meet everyone's needs (or be extensible with a small third-party library).
I think the Rubys and the Perls of the world probably choose too much to add to the standard library, and that's where the comment you're replying to comes from. But, while it's easy to overdo the standard library, it's also bad if you underdo the standard library. Tough and sometimes under-considered aspect of language design.
Earlier quoted context omitted.
I mean, no one's making you use this functionality, why should it be removed?
Not the parent, but my usual response to this is always "well someone's going to use it in the codebase, which means I'm going to have to end up using it too".
Earlier quoted context omitted.
Someone submitted it and people voted on it.
Quoted post unavailable.