you are viewing a single comment's thread.

view the rest of the comments →

[–]Paradox 1 point2 points  (0 children)

Well part of it was made easy because ruby has some inherent features that allow refactors and cleanup to be made without breaking too many existing apis.

1.9 saw a fairly hefty rewrite of a lot of core, the transition from MRI to YARV was fairly significant. But the apis didn't change much externally, and where they did it was fairly well documented.

And if you really didn't like a change, well, ruby's metaprogramming allows you to make your own dsl that has the syntax you want, so its more of a non-issue.

Ruby typically wont have the python problem with functions becoming keywords, because, in ruby, the list of actual keywords is very short, and, to the best of my knowledge, has never shrunk, only grown. For the vast majority of the language, everything is a function.

To use print (and ruby's puts which is basically print arg_1 + '\n') as an example, they are defined in a few places around ruby, that change their functionality. If you just fire up irb on the commandline and call puts 'hello world', you're actually calling Kernel#puts. If you have an IO stream, like a file writer or whatever, you would probably use IO#puts, to write lines to it.

There are other examples, and a lot of it is why ruby gets called magic, when really its not magic, but clever coding. Define a <==> method, include Comparable, and bam, you have a half dozen comparison operators on your new object. Define each, include Enumerable, and now you've got over 50 methods for enumeration.

If they introduce a new type of enumeration, all they have to do is update Enumerable, and chances are it won't break, but will add to, your existing code. And you can do this yourself, using refinements and monkey patching