4 ms·
> However, I don't think i'd feel comfortable with a language that only allows object-oriented programming Ruby is multi-paradigm; in particular it's easily th
by smitherfield 9y ago
> However, I don't think i'd feel comfortable with a language that only allows object-oriented programming
Ruby is multi-paradigm; in particular it's easily the most "functional"-feeling of the major scripting languages.
> and moreover OOP of the old way (a method must be tied to only one object. This is what prevents me from going to Smalltalk, btw.)
I'm unsure what you mean by this. Ruby has one of the most flexible OOP systems in existence, a good deal more flexible than Python's, and lets you create more or less any conceivable relationship between methods and objects. (Which is why Ruby is slow).
> Additionally, the MRI is perhaps the slowest implementation of a dynamic language out there (besides "R"). I know there are alternative implementations; is there any implementation that is significantly faster (at least as fast as Google V8 for ECMAScript) and that supports the full Ruby language without compatibility issues?
Ruby's not fast, but it's improved quite a bit from the 1.8 days. It's comparable to Python.
As for high-performance alternative implementations, there's TruffleRuby,[1] but it still has compatibility issues and isn't ready for production use. There's also Crystal,[2] which is a very similar (but incompatible) compiled language with performance on par with Go/Java/Swift. It's also still in beta but they plan to have a 1.0 release by the end of the year.
[1] https://github.com/graalvm/truffleruby https://github.com/graalvm/truffleruby
[2] https://crystal-lang.org https://crystal-lang.org
- flavio81 9y agoFirst of all, thank you very much for your informative reply on the implementations. >I'm unsure what you mean by this. I believe that any OOP system that wants to be flexible, modern, and powerful, should have most of the features that CLOS (Common Lisp Object System) has. Julia (language) did, for example. It would be lengthy to explain all the features and benefits of CLOS here, but in CLOS, methods are not tied to objects, and all methods do multiple-dispatch. This also allows doing OOP in a functional-like way (this is easier to understand once you see how CLOS works.) In comparison, most other OOP systems feel limited and restrictive, and very different from CLOS. >a good deal more flexible than Python's Probably, but OTOH Python's OOP system is perhaps one of the weakest OOP systems out there, and speaking from my 2 years of professional experience with Python. I find it acceptable, but not good.
- jasonwatkinspdx 9y agoThere are plenty of lispers in the ruby world. "Ruby is an acceptable lisp" is a decently common saying. While Ruby's OO is not a verbatim copy of CLOS, it is much more versatile than you've described above. The best way to think of it is it's delegation under the hood using a little syntax sugar to resemble classes. It's not multiple dispatch, but methods can be aggregated into modules that can be mixed into classes or objects arbitrarily. Dispatch is dynamic and structural (duck typing). All of this combined with ruby's meta programming features make for an expressive system. It's not restrictive, in fact it runs the risk of the opposite problem, which is people over use the flexibility and write overly magic code that proves difficult to maintain down the road.
- flavio81 9y ago>"Ruby is an acceptable lisp" is a decently common saying. I got excited the first time I read that phrase (i think it was Matz who said it?), but they are very very different languages; for example metaprogramming is a piece of cake in Lisp, while it is something reserved for advanced Ruby users, to put just one example. And for me, metaprogramming is extremely important. In any case, I think i'll give Ruby a second look.
- eropple 9y agoI wouldn't say that metaprogramming is for "advanced Ruby users" at all, FWIW. I find writing dynamic/"unfolding" Ruby code much, much easier than wrangling Lisp macros. It is worth your time.
- cutler 9y agoI just don't get the Ruby/Lisp comparison. How can a language based on OO dot syntax compare with a language based on nested parentheses and homoiconicity? They're worlds apart. Is it lambdas? Python and Javascript have lambdas - so what?
- devmunchies 9y ago> they plan to have a 1.0 release by the end of the year. Actually that was delayed to next year. https://groups.google.com/forum/#!msg/crystal-lang/k0yjUGfzc7w/lWogutYaBAAJ https://groups.google.com/forum/#!msg/crystal-lang/k0yjUGfzc...