HN Theater @HNTheaterMonth

The best talks and videos of Hacker News.

Hacker News Comments on
Ruby 2.0: What We Want to Accomplish in the Near Future

UserGroupsatGoogle · Youtube · 46 HN points · 1 HN comments
HN Theater has aggregated all Hacker News stories and comments that mention UserGroupsatGoogle's video "Ruby 2.0: What We Want to Accomplish in the Near Future".
Youtube Summary
Filmed at Twilio in San Francisco on October 7, 2010 - Matz, the founder of Ruby talks about Ruby 2.0 and the future of Ruby.

Matz begins with a brief history of Ruby and then moves on to cover topics like what Ruby 2.0 means for enterprise customers, Ruby for digital appliances, and Ruby in distributed systems.

The event was presented by Fukuoka Ruby Business Hub Promotion Committee and btrax, inc. Sponsors include Invest Fukuoka and Hacker Dojo. Produced by Marakana.

Check out Marakana.com/techtv to see more educational videos on open source.
HN Theater Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this video.
According to Matz last year,

"The version number goes up to 2.0 but the changes are rather small. Smaller than the ones we made in 1.9."

http://www.rubyinside.com/ruby-2-0-implementation-work-begin...

Here's a Quora thread with links to a presentation by Matz and a summary by Yehuda Katz: http://www.quora.com/Ruby-programming-language/What-are-the-...

"Language improvements:

- Named arguments.. 1.step(by: 2, to: 10) { ... }

- Selector namespaces (unclear to me whether this differs from refinements as described by Katz)

- Multiple inheritance

Interpreter Improvements:

- Incremental performance improvements over 1.9's VM

- Better compatibility with non-unix environments and small/constrained devices (embeddable)

- Sandboxed VM's (VM per thread)"

Matz's presentation: http://www.youtube.com/watch?feature=player_embedded&v=t...

Yehuda's summary of "refinements": http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-pra...

mitchellh
> * Sandboxed VM's (VM per thread)

This will not make it into Ruby 2.0.0:

https://bugs.ruby-lang.org/issues/7003

propercoil
Multiple inheritance is the major one for me.. been waiting a long time for this
muirbot
I'm seeing contradictory information about this. Is multiple inheritance in or out?
nahname
What does multiple inheritance provide that isn't better achieved through composition/modules?
phillmv
Why is that even something worth working on? I find modules work pretty good.
gamache
Sometimes you want to express multiple is-a relationships at the same time. In that case, composition is a hack, and multiple inheritance is a better match for the concept.

I prefer having more options how my objects behave than fewer.

But, since Ruby 2.0 does not and will not have multiple inheritance, this is all off-topic.

account_taken
Agree with you. Didn't we learn from C++ that multiple inheritance is good in theory but in practice a horrible idea? Ruby already lets you be 'magical' in too many ways.
pjmlp
It is also available in Eiffel, OCaml and Python.

So there are some good ways to make use of it.

But I agree interfaces/traits is a better way of dealing with multiple inheritance scenario.

draegtun
Perl (5 & 6) also has multiple inheritance. Current best practise in the Perl community is to avoid using MI and instead make use of roles.

ref: https://metacpan.org/module/Moose::Role | http://en.wikipedia.org/wiki/Perl_6#Roles | http://modernperlbooks.com/mt/2009/05/perl-roles-versus-inhe...

lmm
Magic is bad, but multiple inheritance isn't magic; it's clear and obvious, the only potential wrinkle being method resolution order when two superclasses define the same method, which is fine as long as it's consistent and documented.

Almost all of the problems with multiple inheritance in C++ are to do with the static type of an instance, and go away in a language where everything is virtual by default, as in ruby.

lloeki
> Didn't we learn from C++ that multiple inheritance is good in theory but in practice a horrible idea?

No, we learned from C++ that C++ multiple inheritance is an atrocity. Python's MI works in a clear and obvious way, similar[0] to how the Ruby inheritance chain is clear and obvious. MI really doesn't fit Ruby though, and IMHO would look too bolted on.

Most of the time the problem is people beating the platform they develop on into submission, instead of embracing it by getting a clear picture of what happens.

[0] As _why said[1], python and ruby are damn close: you can easily get something similar to Ruby's modules and inject them dynamically in the inheritance chain: https://gist.github.com/3951273

[1] https://github.com/whymirror/unholy

tenderlove
> Named arguments

yes, though it's basically an optional argument hash. AFAIK, you can't do required named arguments without weird hacks, or specifically checking the arguments. For example:

    irb(main):007:0> def foo(bar: bar, baz: Object.new); [bar, baz]; end
    => nil
    irb(main):008:0> foo(bar: 1)
    => [1, #<Object:0x007fcaa40db4e0>]
    irb(main):009:0> foo(baz: 1)
    NameError: undefined local variable or method `bar' for main:Object
    	from (irb):7:in `foo'
    	from (irb):9
    	from /Users/aaron/.local/bin/irb:12:in `<main>'
    irb(main):010:0>
This hack makes the "bar" parameter required, but only because the value is evaluated when the method is called, and you get a NameError (rather than an ArgumentError).

> Selector namepaces

yes, but it's called refinements. You can see how they're used here: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refin... (sorry for the link to a test, I'm feeling lazy ;-) )

> Multiple inheritance

Sorry, there won't be multiple inheritance.

> Incremental performance improvements over 1.9's VM

yes, ko1 has been working on removing / optimizing bytecodes in the VM.

> Better compatibility with non-unix environments and small/constrained devices (embeddable)

I don't know of any work on this other than mruby, which isn't MRI.

> Sandboxed VM's (VM per thread)

nope. https://bugs.ruby-lang.org/issues/7003

Other stuff:

* DTrace probes

* Better within ruby tracing https://bugs.ruby-lang.org/issues/6895

I run edge ruby against rails daily. The main incompatibilities I've hit in Ruby 2.0 are what methods respond_to? searches (I've blogged about that here: http://tenderlovemaking.com/2012/09/07/protected-methods-and... ), and the `Config` constant has been removed (which is sometimes an issue for C extensions).

EDIT

Just thought of this for the required args:

    irb(main):001:0> def foo(bar: (raise ArgumentError), foo: Object.new); [bar, foo]; end
    => nil
    irb(main):002:0> foo(bar: 1)
    => [1, #<Object:0x007fc65a882f48>]
    irb(main):003:0> foo(foo: 1)
    ArgumentError: ArgumentError
    	from (irb):1:in `foo'
    	from (irb):3
    	from /Users/aaron/.local/bin/irb:12:in `<main>'
    irb(main):004:0>
You could probably define a private method like `required` or some such, like this:

    irb(main):001:0> def required(name); raise ArgumentError, "missing param: %s" % name; end
    => nil
    irb(main):002:0> def foo(bar: required(:bar), foo: Object.new); [bar, foo]; end
    => nil
    irb(main):003:0> foo(bar: 1)
    => [1, #<Object:0x007fcfea143338>]
    irb(main):004:0> foo(foo: 1)
    ArgumentError: missing param: bar
    	from (irb):1:in `required'
    	from (irb):2:in `foo'
    	from (irb):4
    	from /Users/aaron/.local/bin/irb:12:in `<main>'
    irb(main):005:0>
lloeki
So it's syntactic sugar? What a shame. The whole point is having the language handle it so its default behavior is well-known and uniform and not implement umpteenth patterns and validations[0].

[0] e.g assert_valid_keys (raising ArgumentError on a mismatch so it's really only for options={} pattern: http://api.rubyonrails.org/classes/Hash.html#method-i-assert...

tenderlove
Well, it does actually define locals. But, IIRC, it uses the symbol hash parsing productions, so the default values are required. The only way to specify required parameters (without the above hacks) is to do a traditional method definition:

    irb(main):001:0> def foo(bar, baz: Object.new); [bar, baz]; end
    => nil
    irb(main):002:0> foo(1)
    => [1, #<Object:0x007fbc39161ed8>]
    irb(main):003:0> foo(1, baz: 10)
    => [1, 10]
    irb(main):004:0> foo(baz: 10)
    ArgumentError: wrong number of arguments (0 for 1)
    	from (irb):1:in `foo'
    	from (irb):4
    	from /Users/aaron/.local/bin/irb:12:in `<main>'
    irb(main):005:0>
flazy
I really like the required(name) solution.

  module RequiredParameter
    refine Kernel
      def required(name)
        raise ArgumentError, ...
      end
      private :required
    end
  end
Can't wait to test this code. :P
riffraff
another nice vm improvement would be the introduction of unboxed floats in 64 bit architectures (akin to Fixnums)

https://github.com/ruby/ruby/commit/b3b5e626ad69bf22be3228f8...

InclinedPlane
> > Multiple inheritance

> Sorry, there won't be multiple inheritance.

Thank all that is holy in the world.

None
None
angersock
Amen to that.

C++ pretty much ruined that party for everyone.

Jul 02, 2011 · 46 points, 9 comments · submitted by SlyShy
chicagobob
Yes, but this talk was uploaded to youtube 8 months ago.
freakwit
Matz starts talking about 2.0 at about 14m30
frsyuki
RITE is exactly what I want to need.

The problem is that distributed systems (like message queues or notification services) are required to be fast/scalable but very hard to program/debug/test. One solution is embedding plugin mechanism in a carefully programmed framework. There are examples such as Tokyo Tyrant's Lua plugin or Apache Solr's plugin mechanism. But rather than Lua or Java, I want to use Ruby because it's syntax and semantics are very suitable to write plugins.

RITE will make it possible. Ruby may be new standard of embedded languages.

evangineer
Section of Matz's RubyConf X presentation that covers RITE:

http://www.slideshare.net/yukihiro_matz/rubyconf-2010-keynot...

HaloZero
No idea if this is kept up to date but http://redmine.ruby-lang.org/projects/ruby-19/versions/5
Derbasti
The keyword arguments look a lot like the ones used in MacRuby.
chimeracoder
Very interesting. I'll be curious to see how Ruby comes to be used in the near future and how it develops as a language.
ianbishop
Highlights:

* Focus on YARV (Yet Another Ruby VM)

* Improved character encoding support

* Adding parameter distinguishers a la Objective-C/SmallTalk.

    e.g. def step(by: step, to: limit) vs def step(step, limit)
* Adding scope encapsulation to monkey patching to avoid conflicting changes throughout projects

* Adding conflict resolution to Mix-ins by allowing method renaming for conflicting methods

* Add method combinations similar to what exists in Common Lisp

* New implementation of Ruby interpreter for embedded systems (RITE)

   Hoping to dethrone LUA for game programming 
   
   Want to enter appliances and distributed computing
masklinn
> Adding parameter distinguishers a la Objective-C/SmallTalk.

Smalltalk or Python? Would `step(by:to:)` and `step(to:by:)` call the same method or different methods?

HN Theater is an independent project and is not operated by Y Combinator or any of the video hosting platforms linked to on this site.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.