Slashdot Log In
Ruby 1.9.0 Released
Posted by
timothy
on Tue Dec 25, 2007 10:03 PM
from the facetnating dept.
from the facetnating dept.
sciurus0 writes "The 1.9.0 development version of the Ruby programming language has been released. This version has many changes, including a new virtual machine that provides great speed improvements."
Related Stories
[+]
Rails Bigwig Rails on Rails Community 616 comments
Zed Shaw, creator of the popular Mongrel HTTP daemon / library, has decided it was high time to tear into the Ruby/Rails community for many different complaints that he has been collecting over the last few years. "Rails is a Ghetto" is Shaw's self-proclaimed exit strategy from the Rails community. "This is that rant. It is part of my grand exit strategy from the Ruby and Rails community. I don't want to be a 'Ruby guy' anymore, and will probably start getting into more Python, Factor, and Lua in the coming months. I've got about three or four more projects in the works that will use all of those and not much Ruby planned. This rant is full of stories about companies and people who've either pissed in my cheerios somehow or screwed over friends. I can back all of them up from emails, IRC chat logs, or with witnesses. Nothing in here is a lie unless it's really obviously a lie through exaggeration, and there's a lot of my opinion as well."
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Firehose blurp (Score:2)
Re: (Score:2)
It goes without saying that an open source project is always fixing bugs, hopefully at a slightly higher rate than they are introduced.
Benchmarks mean nothing, specially these ones. (Score:2, Insightful)
Re:Benchmarks mean nothing, specially these ones. (Score:5, Informative)
Parent
Why Ruby? (Score:2)
Alright, I know this is going to be flame fodder, but I'm genuinely curious: does Ruby have anything to offer for someone who's already very proficient in Python (and Django, so Rails is already covered)? Basically, I've been using Python for quite a while and work with a largish codebase at the office. Is there any reason why I should give Ruby a try other than the standard - and very valid - "because it's there"? From what I've heard it seems that the two languages occupy roughly the same niche and are
Re:Why Ruby? (Score:4, Insightful)
Speaking as a ruby developer, if you're happy with python - not really! Python's also great. It's just a matter of which suits your style. Personally, I couldn't get over Python's syntactically significant whitespace - many people would laugh at that, but for me it's just unthinkable. So Python was just ruled out for me totally because of that.
Python and Ruby are both competing to be the most beautiful next-gen languages
Parent
Re: (Score:2)
I find myself adding additional if/loop statements around a block of code often enough that I just couldn't imagine working with python where it isn't trivial to automatically indent the block of code, since the indent is the block of code. Copying/pasting code is another case where the indentation is not necessairly correct. I am not talking about duplicating code here, but something like taking a chunk of code and making it into a function call.
I really like how
Re: (Score:2)
Re: (Score:2)
Love it or hate it, it's simply not a show-stopper.
Haskell, too, has significant whitespace, though, unlike Python, you can relax the whitespace significance in Haskell.
Re: (Score:2)
That definitely falls under "WTF where they thinking?!?" where a single, invisible, space can bork up your code.
OK, does anyone really write significant amounts of code in Notepad? That's the only editor I'm aware of that doesn't have any form of Python syntax highlighting available. Emacs or Vim or Kate or Eclipse will cheerfully steer you around that single, invisible space so this only seems to be a problem in the minds of people who want to invent reasons to dislike it.
FFI (Score:3, Funny)
Re: (Score:2, Insightful)
I think Ruby is really an evolution of Perl. There are a lot of Perlisms in its syntax, and I bet it'd be ve
Re: (Score:2)
Re: (Score:2)
Re:Why Ruby? (Score:5, Interesting)
Parent
Re: (Score:2)
Re:Why Ruby? (Score:4, Informative)
Alright, I know this is going to be flame fodder, but I'm genuinely curious: does Ruby have anything to offer for someone who's already very proficient in Python (and Django, so Rails is already covered)?
Parent
Re: (Score:2)
Python currently has larger library support.
Personally I see no need for you to reinvent your wheel, but you'll probably not be gratified as to the validity of your decision until you dig a little.
Re:Why Ruby? (Score:4, Interesting)
* The built-in classes support functional-style programming. That is, the default action is generally to return a modified copy of the object being acted upon, so you can chain method calls together. This doesn't work well in Python, because methods frequently act like "procedures", modifying the object and returning nothing. Sometimes, Python programmers work around this by explicitly copying objects and then calling such methods. Other times, modifying the persistent object is just what they wanted; in Ruby, you would use a method which ends in "?", which is how Ruby identifies (by convention) methods that modify the object.
Thus, to combine two dictionaries in Python, without modifying either of them:
dcombined = d1.copy()
dcombined.update(d2)
In Ruby:
dcombined = d1.merge(d2)
Obviously the Python code is fine, but from a functional programming viewpoint, it looks awkward.
* It's entirely predictable whether a built-in class's method will modify the object, because of the "?" suffix convention. In Python, you don't have such an explicit convention, which can sometimes make more work for the programmer.
* Ruby doesn't rely on global functions as much, or "builtins" as they're called in Python. If you want to know the length of something, or convert a string into a list of characters, you call a method of the object rather than a global function. Some people find this to be easier, given that you only need to focus on one paradigm (object-oriented) and not two (e.g., object-oriented and imperative).
* The print statement in Ruby prints only what you tell it to, rather than adding whitespace in various cases. Since this is the behavior of print or printf in most languages, this is nice. Ruby offers the puts method for those times you want whitespace helpfully added (like Perl 5.10's say).
* regular expressions are more tightly integrated. Some people consider this a disadvantage of Ruby though, because you can write less explicit code.
* Ruby gives you fewer types of quotes to learn, because ' and " are multiline.
Parent
Re: (Score:3, Informative)
Re: (Score:2)
Re: (Score:2)
This is indeed a useful feature, but it's not really functional programming, just a different style of object oriented design. The complete absence of any functions in your example might have served as a clue. :)
Re: (Score:2)
Re: (Score:2)
Sorry.
Re:Why Ruby? (Score:4, Insightful)
Ouch. Try this one:
It scales easily (add "+ c.items()" to mix in another dict) and doesn't have any restriction's on the keys' datatypes.
Parent
Re: (Score:3, Insightful)
You've got me there. Ruby could stand to clean up its act and be more consistent here. It still has quite an advantage, though.
Re: (Score:3, Interesting)
Different style of programming (Score:3, Insightful)
If you look at it from a features and libraries perspective, then you really won't find much different. But you shouldn't look at it that way.
There's a significant programming style difference between the Python and Ruby communities. Python programmers, as a general rule, tend to be more inclined towar
Re: (Score:2)
To program in for fun, yes. To do things you'd never have thought of doing, yes.
Blocks and iterators: [1,2,3].collect {|x| x ** 3 }.each {|x| puts x.to_i }
It's like specifying arguments that contain code. Functions you otherwise would have to pass a ton of arguments to, or provide a call-back function for, take an anonymous block.
Ruby's a very quick language. You can get something done quickly like Perl, and it has nice shortcuts like "foobar" =~
Re:Why Ruby? (Score:5, Interesting)
The heart of Ruby is its use of idiom. It's a difficult thing to describe, and I don't know how you'd find some metric to measure it, or to compare it to another language. But it's very clean, and very sensible, and surprisingly simple, at least on the surface.
There's a kind of aesthetic pleasure to be had in the syntax of Ruby. I was about to write that in that sense it's kind of an anti-perl, but that's flame bait, and I never connected with perl, and lots of people probably find perl beautiful. But Ruby is really great.
You can do things like:
1.upto(10) {|x| puts x }
Which does:
1
2
3
This thing looks a lot like an old fashioned for/each loop, but it's an iterator, and the code in the curly brackets is a closure. So under the hood, it's fairly different from a for/each loop.
There are a few things to mention about this.
First, because there are lots of iterators on the shelf, and because you can write your own iterators if you want, this thing is a lot more powerful than looping constructs in many other languages.
Second -- and this is the sort of thing I was trying to get at above -- the syntax for closures is tweaked so it makes human intuitive sense when you're using closures with iterators. In your head, you might be thinking in for/each terms, and the syntax colludes with you if you want to hang on to that useful fiction.
In Lisp, you can never forget about the lambdas. In Ruby, you just sort of do what you want, and the lambdas are there under the hood, but they're not jumping out at you in the same way. Ruby's syntax fits the way a lot of people think, and it hides the stuff that it makes sense to hide, and exposes the stuff that it makes sense to expose.
And when you write out that line of code, its meaning is very clear and easy to grab a hold of, and it turns out that it's usually very concise and compact as well.
This is a little redundant, but I want to stress it, that line of code really is a pretty thing, in a sense. It's not so remarkable if you think of it as a for/each loop, but it's not a for/each loop -- it's an iterator and a closure, and that's a somewhat complicated thing, but here it isn't complicated, or opaque. It's clean, and it makes sense, and it's concise, but most of all, the shape of the code conforms to the shape of the idea in your head. That's what Ruby is all about, and you see that over and over and over again.
Third, this approach to idiom is a real dual edged blade for me, because there's a culture in Ruby books that sort of says, "You know what this line of code is doing, so don't worry too much about the lambdas." For a long time, I felt lost in Ruby -- like, I kind of knew what the code was going to do, but I wasn't exactly sure what was going to happen under the hood. That's a really uncomfortable place to be. I had to watch the SICP lectures to really grab hold of Ruby.
It's always dangerous to talk about some other culture -- I could be way off base here, and I hope I don't say anything really dumb. But it feels Japanese to me -- it reminds me of a drawing where there aren't many lines, but all the lines are kind of perfect and clean. It's got that same sense of elegance to it. Let's boil this big thing down to its essence, and make it beautiful and sparse.
I can't tell you that Ruby is better than some other language. But I can tell you that it's very beautiful, and that the beauty lives in lots of small little details. The experience of learning and using Ruby is one of noticing these little things and saying, "Wow, how great is that?"
I used to live in an apartment building that had been designed by a famous architect -- Mies van der Rohe. The design made a difference -- I can't tell you why or how, exactly, but it d
Parent
I'd like something else. (Score:3, Insightful)
Is parallelization the only niche that isn't supported well? No. There are other areas languages generally do badly in. There are very few languages which handle internationalization efficiently. There are very few languages which handle graphical interfaces efficiently or logically. Languages are typically either good at handling very complicated data structures OR handling structures that are defined just-in-time, typically not both.
My interest in Ruby would be greatly increased if I saw it do something that very few other languages could do, preferably no language that was in mainstream use.
Re:I'd like something else. (Score:4, Interesting)
If you want the evidence, the data, the background, I've no objections to stating it. Well, with the exception of commercial projects still covered by non-disclosure agreements. Even if the company betrayed not only me but also the other software engineers there, resulting in engineers being deprived of rightful wages, forced out or removed under false pretenses. I have ethics, even if they do not. The bulk of my experience is NOT covered by any NDA, but is a little on the lengthy side. People get paid good money for writing books with less content. If you actually want to know, I have no objections, but it's not something anyone would be willing to read on Slashdot as a reply or even as a main article.
Parent
Re: (Score:3, Interesting)
Re: (Score:2)
Re: (Score:3, Interesting)
Now, I would not call myself remotely qualified to write an article (or a
where's unicode? (Score:3, Interesting)
Re:where's unicode? (Score:4, Informative)
Parent
Speed Improvements Are Nice, But Not Enough (Score:2)
Last I measured, Ruby was about a factor 300 slower than C on low-level code (measuring the performance of high-level functionality implemented in the interpreter is not so interesting, becau
Re: (Score:2)
You seem to be thinking of Rails, which is a framework for Ruby used for making web apps.
Ruby itself is quite nice for general development work.
Re: (Score:2)
But RUBY always seems to have to rely upon other languages to scale. The RUBY website uses PHP. The Rails website uses PHP.Seems every place that RUBY has to scale requires it to use another language and the RUBY maintainers have not tried to excuse this but the RUBY community ha
Re:Scalability? (Score:5, Insightful)
I use it heavily as my general scripting language; where I would have used Perl for small utilities, file munging or what have you before, I now use Ruby. Not because Perl is bad - it isn't - but Ruby really is in many respects Perl done right, with many of the benefits and without the syntactic quirkiness. Scaling just isn't a factor for most uses of a script language.
Parent
Re: (Score:2)
I think my two favorite things about Ruby when compared to Perl (which, like you, I used to use for scripting) are:
1) I can actually *read* it because it doesn't look like I rolled my head around on the keyboard
2) It behaves in Windows the same way it does in Linux (with the obvious exception of having to change any hard-coded filenames you
Re: (Score:2, Insightful)
Excuse me but http://www.ruby-lang.org/ [ruby-lang.org] runs on Radiant CMS [radiantcms.org], which is written in ruby, not on php.
Re: (Score:3, Insightful)
Re: (Score:2)
2) Granted. Yet the Ruby community seems more cohesive than other languages. JRuby and Rubinius are intentionally staying close to Ruby. Of course, in JRuby, much of what you do wouldn't work without the J, so it's not back-portable, but technically would be.
3) See 1. A ruby process only wastes the time interpreting and garbage collectin
Re: (Score:2)
Scalability today means using the multiple cores that my processor has. Ruby provides no real means for doing this (e.g., native threads). Sure, you can launch multiple ruby processes, and chat between them with IPC, but look at the overhead of a ruby process ...
Umm, you seem to be confusing performance with scalability here.
I'd say that a program based on processes communicating via IPC is far far more scalable that a program based on threads sharing memory.
The processes + IPC program can be distributed across several machines; the threaded program cannot. The fact that the threaded application is slightly faster is irrelevant since it cannot scale beyond a certain point.
It's easy to forget that hardware costs very little compared to developers' time.
Di
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Also, languages are not by themselves slow, the virtual machines or interpreters are, so saying a language is slow is nonsensical.
Well, yes and no. One can meaningfully say that "Language Foo is harder for an implementation to optimise than language Bar". In practice "harder" will often been completely infeasible.
Here's some examples I've plucked out of the air:
Re: (Score:2)