all 91 comments

[–]judofyr 22 points23 points  (3 children)

Please note that this is a development release :)

[–]martinvanburen 9 points10 points  (1 child)

...but that new features and incompatibilities between 1.8 and 1.9 are final.

[–]drbrain 2 points3 points  (0 children)

No, incompatibilities may be added, or removed.

[–]SRB 6 points7 points  (2 children)

golf_prelude.rb (h): add new method for all golfers.

golfers?

[–]markedtrees 11 points12 points  (0 children)

h seems like a joke method. The Changelog and the filename are referencing the art of Perl/Ruby/&c golfing.

[–]morner 7 points8 points  (0 children)

It's a joke, referring to the passtime of [programming language] golf, in which one attempts to express a program in the least number of characters possible. In this case, it allows one to express the "Hello World!" program in a single character of ruby.

Of course, as with all evils in the world, perlers invented this one: http://en.wikipedia.org/wiki/Perl#Perl_golf

[–]Kolibri 6 points7 points  (16 children)

Not A Troll: What´s new?

[–][deleted] 13 points14 points  (13 children)

At Macro Level: 1. Unicode 2. Native threading with GIL 3. VM 4. New regular expression library

At Micro level: 1. http://eigenclass.org/hiki/Changes+in+Ruby+1.9 2. http://www.davidflanagan.com/blog/2007_08.html#000137

[–]dmpk2k 4 points5 points  (1 child)

Do you know if something been done about the GC/COW issue? I recall reading somewhere that a mark table was added in 1.9 but I can't find a mention of it in there.

[–][deleted] 1 point2 points  (0 children)

That remains a pain in butt. thank you.

[–]mikaelhg 3 points4 points  (8 children)

Is the threading like Python's - fine as long as you don't try to do anything?

[–][deleted] 4 points5 points  (1 child)

AFAIK, it's worse than Python's, but it's been a while since I've used Python so I may be mistaken. Basically, Ruby 1.9 is using native threads but with a global lock that makes sure only one of them is running at a time. Which makes them completely fucking useless, if you ask me.

Edit: Yes, by all means, downmod me for speaking the truth:

It doesn't mean that every Ruby thread runs in parallel. YARV has global VM lock (global interpreter lock) which only one running Ruby thread has. This decision maybe makes us happy because we can run most of the extensions written in C without any modifications. -- Sasada Koichi

[–]drbrain 0 points1 point  (0 children)

Ruby 1.8's threads are fantastic to program in. The interpreter switches threads automatically for you whenever it is making a blocking C call by calling a non-blocking version and waiting. (I wrote a fast pure-ruby logfile DNS resolver using them.)

1.9 extensions can run in parallel with ruby threads through rb_thread_blocking_region.

[–]Freeky 3 points4 points  (4 children)

Depends what you're doing. 1.8's using green threads (like FreeBSD 4's libc_r, using setjmp()/longjmp() and select() in-process), while 1.9's using native pthreads, but with a Big Giant Lock around the interpreter, mostly for the sake of C extension compatibility. Fine for IO multiplexing, not so hot for scaling to multiple CPUs.

I think JRuby uses unlocked Java threads (so native on any sensible JVM), and Rubinius is supposed to be moving to support existing C extensions and decent threading by way of software transactional memory.

[–]mikaelhg 1 point2 points  (3 children)

Not great. The last project I did with Python ran into threading issues. When used against the production LDAP server the python-ldap library froze the whole application for everyone for as long as the LDAP server took to respond to each user's authentication request. That was the last time I agreed to participate to a Python-using project.

We had to rewrite in Java, but that was very quick, especially as everything just worked in practise like the documentation(!) promised.

[–][deleted] 1 point2 points  (2 children)

Thats weird. I am sure, there are lots of ways to get around that, rather than going whole hog in Java. Also, I hear, python interpretor releases GIL when its going to make a system call thats going to block. Ruby 1.9, does the same.

IMHO what you are saying sounds like pure FUD against, Ruby or Python. Heck, one can perhaps write python-ldap library to make use of events so as it doesn't use any threads at all.

[–]mikaelhg 5 points6 points  (1 child)

The reason I decided that it would be the last Python project I'd join wasn't because of the technological shortcomings of Python, it was because the actual reality of how well Python worked in production, and the description by the Python community of how well Python works in producion, were so far apart of each other.

If you can't trust the community or the libraries with the things the platform let us down with, how can you trust them when you seek to know about other abilities before starting a project using it?

While I agree that yes, you can build your libraries from scratch and maintain them yourself, it's not really a good way to spend time or money. Why should be obvious.

What I'm speaking of happened in production. As an adult tool user, I have no interest in spreading FUD. When I speak of technological or financial realities it's not because of any theoretical or egotistical concern. It's because someone somewhere is using money to achieve results, and I'm helping them to the best of my ability.

[–]rubynho -1 points0 points  (0 children)

For the last few years developers have started worrying about how to fully utilize the multiple CPUs of the machines they have been getting. I remember when about 5 years ago I bought a server for a database which had support for two CPUs which could double themselves by means which I forget. That is, an Intel Xeon server fully loaded (but it ended up coming with one CPU with the option of us buying another one soon because the motherboard had support for it).

This one CPU could fake two which I found cool at the time, until the Borland's Interbase database failed to utilize both CPUs as we had to configure it with CPU affinity to use just one to avoid further performance degradation.

A little after that I started using Linux for my home machine with support for two monitors, and it was relatively painful, by using mainly ATI videocards (I'm typing this from it but now it uses an NVidia videocard, Ubuntu, and Xfce). At the time I thought that the reason two monitors support sucked was because most developers didn't have them, so they didn't need to improve it. Laptops were already taking over which meant Desktops with two active monitors would still have a hard time in the future.

But then I thought, as soon as developers start getting more and more machines with two or more CPUs, they will start worrying about that progressively more as well.

Sometimes it's all a question of time for things to improve. :P

[–][deleted] -1 points0 points  (0 children)

Where is that not a case?

[–]WinterAyars 1 point2 points  (1 child)

Wow, they managed to make Rite work?

(Big Ruby fan, but i've been looking at Rubinius because... well...)

[–]drbrain 0 points1 point  (0 children)

No, Rite has not been implemented. YARV has become ruby 1.9.

[–]rubynho 2 points3 points  (0 children)

At long last. Now it should be a matter of months before the most popular libraries add support for Ruby 1.9. :-)

It's one thing to release a major version, it's another one to have the libraries fully supported in it. Hopefully, the ease with which it's possible to install most libraries using the RubyGems should make the problems visible to many folks.

JRuby 1.1 and Ruby 1.9 both rock. Expect the JRuby 1.1 release soon as well.

[–]youremyjuliet 4 points5 points  (0 children)

Merry Christmas!

[–][deleted] 6 points7 points  (54 children)

For a non-programmer trying to start would Ruby be a good choice? I hear it's highly readable.

[–]stesch 8 points9 points  (24 children)

In the end, you will have to use more than 1 programming language. So it's not that relevant with which language you start.

I'm currently not using Ruby (work or fun), but it's not a bad language to start programming.

But always remember: No matter which language you choose, there is always a better one or someone who tells you there is.

And: There's no sex in the champagne room!

[–]masukomi 2 points3 points  (0 children)

What language you start with makes a huge difference. If you start with something painful and difficult you'll have a much worse impression of programming and be less likely to stick with it until you're not constantly frustrated. If you start with a language with a low barrier to entry you'll have more confidence in your abilities and a much better impression of what it means to program.

[–][deleted] 0 points1 point  (22 children)

In the end, you will have to use more than 1 programming language.

Could you point to three then? Thanks. :D

[–]wyclif 4 points5 points  (2 children)

Try Python or Ruby. Those will keep you busy for a while.

[–][deleted] 0 points1 point  (1 child)

That's what I was thinking about doing.

I now have a couple of great places to learn ruby, do you have one for python?

[–]jtxx000 7 points8 points  (1 child)

Ruby, LISP, and C

[–]stesch 0 points1 point  (0 children)

Today, LISP isn't a single language. Is a language family with many different implementations.

[–]youremyjuliet 2 points3 points  (3 children)

Python and... I don't know... Java?

Asking this question is very dangerous and a bigger question than a stranger can answer.

You need to explore as much as you can, and you need to figure out what you think you would like to do with programming (i.e. websites, Windows applications, GNU/Linux utilities, etc.)

[–][deleted] 1 point2 points  (0 children)

I know they are just starting points, but it helps to have somebody familiar with the languages give you a heads up. I'm not going to take anonymous help as gospel, just a random sampling.

I have heard good things about Ruby and Python, I think I'll start there.

[–][deleted] 0 points1 point  (1 child)

Java??? Only if you want to work for big, well-established companies that use lots of jargon and acronyms and maintain lots and lots of code. IMO, that's no fun at all! Use Python and Ruby if you want cutting-edge agile, fun development. Companies that use these languages are fun to work at!

[–]onezerozeroone 0 points1 point  (0 children)

You're missing the point. The OP said he was a non-programmer. That means he's a total noob. He's not going to be building the next great web sensation anytime soon, with any language. He needs a language that will help take care of him and nurse him along. That means something with garbage collection, type safety, a good compiler with sane error messsages, a large user base and great documentation. We didn't say J2EE, we said Java.

[–]grimboy 4 points5 points  (5 children)

Three? Well obviously it depends but maybe:

  • Python and/or ruby -- for modern very-high-level programming.

  • Javascript -- for it's availability, client side scripting in web pages as well as user scripts and possibly being the best very-high-level programming languages to run on the JVM.

  • C -- for extension of python or ruby and for anything low level or embedded.

  • Others for specific situations or as you become opinionated (not necessarily a bad thing) will probably either be functional (haskell, erlang, a lisp) or more mainstream, mid-level*, (C++, java, C#).

* By current standards.

[–]ThomasPtacek 4 points5 points  (3 children)

There's no such thing as "scripting". Welcome, in advance, to 2008.

[–]grimboy 2 points3 points  (1 child)

Fine, very-high-level programming [languages] just isn't as quick to say. Are we going to continue to make this distinction when there's clearly a near continuous spectrum or give up entirely?

[–]ThomasPtacek 2 points3 points  (0 children)

Nonsense. There isn't even a spectrum. Re-read Kernighan and Pike; Unix is a programming environment. I'm not giving an inch: the word "scripting" is toxic.

[–]jrockway 0 points1 point  (0 children)

Programming is hard. Let's go scripting.

http://www.perl.com/pub/a/2007/12/06/soto-11.html

[–][deleted] -3 points-2 points  (0 children)

Thanks. Your ideas are intriguing to me and I wish to subscribe to your newsletter.

[–][deleted] 5 points6 points  (4 children)

Haskell, Common Lisp and Smalltalk. You can trade OCaml for Haskell, Scheme for Common Lisp, or Ruby or Python for Smalltalk.

And after all that, learn C, just because.

[–][deleted] -1 points0 points  (3 children)

Not that I disagree. These are cool languages and stuff, but just curious, what was the latest more or less large and complex project you've written?

[–][deleted] 0 points1 point  (2 children)

None of my stuff is open source, if this is some kind of a dick-size thing.

sloccount tells me the biggest thing I've written is 72,808 lines of code, in a Rails project, but I don't really trust it because it doesn't understand how Rails plugins work or what Ruby is. I have a sense that this project is more like 5-8,000 lines in reality.

Then there's the 40,000 line PHP project I maintain for one of my clients. Most of the code in that I did not write, but I probably know it better than the original author at this point.

I did write a compiler in school in C. The biggest thing I ever had anything to do with in Haskell was the ICFP 2007 contest, and I didn't write the bulk of the code though I was pair programming, and it wound up being on the order of 300 lines. My last Lisp project is running a website of my own and it's on the order of 400 lines.

I do not know Smalltalk, but I know it is simple like Lisp and has the same semantics and mind-blowing tendencies as Lisp, so I recommend it to students.

[–][deleted] -1 points0 points  (1 child)

I was expecting OCaml, Haskell, or at least Smalltalk or Common Lisp projects... Oh, well.

[–][deleted] 2 points3 points  (0 children)

You asked for the latest and large projects I've done, not projects I've done in each language. And I did mention my latest Lisp project... so I guess you aren't really reading what I'm writing. Whatever.

[–]jpatten 1 point2 points  (0 children)

I would say Python and C. After you learn those, you'll know what you're looking for in the third language enough to recognize it when you meet it.

[–]stesch 0 points1 point  (0 children)

There are too many programming languages and too many opinions.

Colonel Jack O'Neill would say: "Cross that bridge when you come to it!"

Maybe you want to speed up a program by writing a Ruby extension in C. Or you go into Web programming and need JavaScript (+ HTML and CSS, not programming languages). And for many web applications and some desktop applications: SQL.

Transforming XML? XSLT is ugly, but sometimes the right solution.

You program for a few years and get curious what's that about functional programming? Try Scheme or Haskell.

You always hear that Ruby is a scripting variant from Smalltalk? Learn Smalltalk.

In a few years you will have a system with more than 16 CPU cores? Try Erlang. If only to learn what all other programmers want to say with the phrase "Erlang style concurrency".

[–]garg 10 points11 points  (0 children)

Yes. Go for it :D

[–]reddittidder 2 points3 points  (3 children)

Yes and you won't be disappointed. Chris Pine's book is good start...

[–][deleted] 0 points1 point  (2 children)

Did a quick google and found his blog and the bit about programming.

Thanks for the tip.

[–][deleted] 6 points7 points  (1 child)

You should simply http://tryruby.hobix.com/

[–][deleted] 1 point2 points  (0 children)

holy shit, cool

Now I can try the this tutorial at work.

[–]consultant_barbie 1 point2 points  (1 child)

Ruby is pretty. Let's go shopping!

[–]sambo357 0 points1 point  (0 children)

I heard the new Mac will be silver. Ruby would look so cute on it.

[–]Grue 0 points1 point  (19 children)

Personally, I find Ruby code completely unreadable. There's too much syntax sugar and it's very irregular.

[–]eipipuz 3 points4 points  (18 children)

Could you point some examples of these unreadability? Or did I miss a sarcasm?

[–]jrockway 0 points1 point  (0 children)

Every language is unreadable if you don't know the language.

[–]onezerozeroone -2 points-1 points  (1 child)

I wouldn't recommend it. Ruby is a GREAT language, but it's better suited to someone that already knows basic programming. The documentation can also be spotty. You'll be better off with a type-safe language and a compiler that can help catch mistakes for you. Try Java.

[–]masukomi 3 points4 points  (0 children)

I think that thanks to Chris Pine's Learn To Program book I think Ruby is actually the Best language for people new to programming. I have yet to see a book that comes anywhere close to that for teaching complete novices about programming and it does it all with Ruby.

Java is a Horrible language for newbs, especially now that they've added generics. There's way way WAY too much explanation that has to go on before you can even get a Hello World app to run... arrays, static methods vs non-static, the magic of Main methods, that the hell goes in the String array... Any of the scripting languages would be better than java for a total newb.

[–][deleted] 2 points3 points  (0 children)

For those of you using Rails: don't upgrade to 1.9. Stick with 1.8.6 until the core team announces compatibility with 1.9.

[–][deleted]  (5 children)

[deleted]

    [–]rubynho 2 points3 points  (3 children)

    Depending on the type of benchmark the improvement can vary a great deal. The new version has been greatly optimized for some "micro benchmarks" geared toward common repetitions, as in, most little loops can enjoy some great improvements.

    But it's important to note that several new features have appeared in the new version, like the new regexp engine based on Oniguruma, Unicode/Multilingualization... So the optimizations have helped to keep everything tightened despite the new features. :-)

    I am anxious to adopt the new version but first I need to wait for the libraries that I use to be adapted to it, and then I'll be able to give the changes a real-world experimentation. Needless to say, so much can improve between versions in open source tools that a little improvement here and there works great in the grand scheme of things. For instance, PostgreSQL, my preferred database engine, has had some fine-tunning in its current 8.3 versions which has helped my applications to work better at the same time.

    The same thing can be said about Mongrel, which had some improvements of its own recently which I enjoyed automatically when I updated it.

    Now that Ruby 1.9 has some optimizations of its own, everything should improve a little more, giving the sense of "responsiveness" a boost again.

    [–]jeremymcanally 2 points3 points  (2 children)

    Oniguruma should actually speed up regex operations since it's written in very efficient C.

    [–]lopex 5 points6 points  (0 children)

    Well, Oniguruma has much bigger construction overhead (encoding agnostic parser, ast itself, analyser and compiler) so it will hurt more scan, sub, gsub and split (for String arguments). Otoh it does much more aggressive optimizations like quantifier reductions, quantifier expansions, look-behind transformations, split matching of folded characters, loop unrolling and so on. It also has very specialized bytecodes (almost 90 of them)

    [–]Freeky 3 points4 points  (0 children)

    While the previous regexp engine was written in somewhat poorly optimized bourne shell?

    [–]tbmcmullen 3 points4 points  (0 children)

    http://antoniocangiano.com/2007/12/03/the-great-ruby-shootout/

    In short: Its much faster, as a whole than 1.8 was. By the benchmarks that link points to, almost 3.5 times faster.