Finally... Real keyword arguments.
Meh, can't get excited about them. The hash mechanism, plus the ability to leave out the hash braces, works perfectly well enough for me. All popular languages are doomed to accrete nonessential features until they sink under their own weight ...
A look at Ruby 2.0
11–13 of 13 posts
Re: A look at Ruby 2.0
#12Earlier quoted context omitted.
Well, the obvious case is a "safe monkeypatch", where you want to add some functionality to a class, but only if it hasn't already been added (maybe by some third module). I think this could more easily allow for the use of multiple support libraries (like ActiveSupport) without having to worry about them clobbering each other.
forgive my ignorance, and I'm not familiar with ruby or ActiveSupport, but how does that solve the problem? Wouldn't different module's be expecting the method to be implemented in a certain way, and this would would have the method implemented, but not the version they expect?
Currently, you have to attempt to load baz before you load foo, and then not load foo's implementation of bar, if baz loaded successfully. In the future, you could just prepend foo, and so if baz was already loaded, it doesn't overwrite its optimized implementation. If baz wasn't loaded, then when it does load, it would overwrite the prepended implementation properly.
This just frees you up from having to worry so much about load order. It's not a huge feature, but it's a nice little quality-of-life change.
Re: A look at Ruby 2.0
#13Finally... Real keyword arguments.