Live data from Hacker News

Ruby 2.3.0 Released

ruby-lang.org

41–50 of 73 posts

Re: Ruby 2.3.0 Released

#41

It's really great to see that with every big release, Ruby is making the language even more pleasant to use in addition to the regular performance improvements. Ruby just keeps getting better and better.

Agreed. Been using Ruby for a few years now and it never stops being enjoyable. Hoping it keeps going for many more years!

Re: Ruby 2.3.0 Released

#42
post #40
post #17

with the existence of Perl6, Clojure, F#, Rust, Go, and few others ... For someone who doesn’t know Ruby, why learn it today?

For me: because nothing else approaches it in terms of linguistic flexibility. I learned Ruby about two years ago, after learning...a dozen-ish languages? Something like that. I don't write web applications in it, because Rails grinds my gears for a whole host of reasons, but for my money it is the can-opener language. If I have a problem, I feel like I can generally explore it faster in Ruby (holla, Pry) and build a…

What about Elixir?

Re: Ruby 2.3.0 Released

#43
post #42
post #40

Earlier quoted context omitted.

For me: because nothing else approaches it in terms of linguistic flexibility. I learned Ruby about two years ago, after learning...a dozen-ish languages? Something like that. I don't write web applications in it, because Rails grinds my gears for a whole host of reasons, but for my money it is the can-opener language. If I have a problem, I feel like I can generally explore it faster in Ruby (holla, Pry) and build a…

What about Elixir?

Never used it. Looks nice enough? But never looked like something I'd open in a REPL to hash out a problem. Could be wrong.

Re: Ruby 2.3.0 Released

#45
post #36

Looks like some nice additions. I try to limit the use of .try in rails, however when working with legacy codebases it is much nicer then: if @user && @user.address && @user.address.city city = @user.address.city end Even though I write less Ruby then I once did, I still credit it as the language which shaped my career the most. I have worked so many great jobs because of Ruby.

Yup. In addition to the general purpose safe navigation operator we also have Hash#dig now which helps with those pesky nested params:

params.dig(:user, :address, :city)

Re: Ruby 2.3.0 Released

#46

I couldn't find any actual examples on how to use the new frozen string literals. Lots of discussion in the link provided, but that's it.

The NEWS file defines what the pragma actually is,[1], but you'd use it like so:

    # frozen_string_literal: true
    str = 'foo'
    str 
This will now produce an error:

    # main.rb:3:in `': can't modify frozen String (RuntimeError)
It's equivalent to Ruby 2.1's String#freeze:[2]

    str = 'foo'.freeze
    str ': can't modify frozen String (RuntimeError)
Except that it will affect all strings created after the pragma mark.

You can also trigger this behavior globally with the --enable=frozen-string-literal option.

[1]: https://github.com/ruby/ruby/blob/v2_3_0/NEWS#L17-L26

[2]: http://ruby-doc.org/core-2.2.3/Object.html#method-i-freeze

Re: Ruby 2.3.0 Released

#47

Ah, YARV finally adds bytecode compilation and loading as an "experimental" feature. It'll be interesting to see what people do with it.

I could see it making deployment faster or nicer. Imagine being able to compile all the byte code for a Rails app locally and just shoving that up instead of waiting on bundling and all that. Also I think this would make possible hot code upgrades which are cool but probably more work than their worth. Unless you can build smart hooks into background job and web server libraries that only change the byte code in betw…

After reading the patch that introduced the byte code compilation it seems what I was hoping to use it for are clearly not goals of the project: https://bugs.ruby-lang.org/issues/11788

Re: Ruby 2.3.0 Released

#48
post #32

This is actually a really great release. `&.` removes the really annoying (and slow) `try`. And I think the string literals freezing is going to solve a lot of problems with memory allocations. Check out this PR for Rails that covered a lot of similar performance problems created by too many string allocations. https://github.com/rails/rails/pull/21057/files I wish Rails 5 could go all in on Ruby 2.3.0 and frozen str…

How prevalent is `try` in rails/activesupport? My benchmarks show that the lonely operator is ~2x faster than `try`. I'd expect someone to create a gem that monkey patches `try` for those running 2.3.0.

`try` is pretty prevalent in rails dev from what I've seen in the field.

Re: Ruby 2.3.0 Released

#49

Nice to see "Did You Mean" suggestions flourishing across various tools now, e.g. Git too. Error messages can be a whole lot more than indecipherable jargon, even for command-line warriors. I'm also looking forward to never writing "if foo && foo.bar" again! Congrats and happy holidays Ruby team :).

Well, git's "did you mean" is probably the most frustrating command line experience imaginable, but it's quite nice in a language!

Re: Ruby 2.3.0 Released

#50
post #42
post #40

Earlier quoted context omitted.

For me: because nothing else approaches it in terms of linguistic flexibility. I learned Ruby about two years ago, after learning...a dozen-ish languages? Something like that. I don't write web applications in it, because Rails grinds my gears for a whole host of reasons, but for my money it is the can-opener language. If I have a problem, I feel like I can generally explore it faster in Ruby (holla, Pry) and build a…

What about Elixir?

And python...
Post reply on HN