eigenclass logo
MAIN  Index  Search  Changes  PageRank  Login

Experimental features withdrawn from Ruby 1.9

Here follows a list of experimental features that were at some point in Ruby 1.9 and were thus listed in the Ruby 1.9 changelog I maintain.

I will add things as I remember them or remove them from the changelog.

->() syntax for blocks

You could do things like

 arr.each ->(x){ puts 2*x }

Note that the ->() syntax for lambdas still exists.

New constant lookup rules

Now constants were looked up in the following order:

  1. current class
  2. super classes except Object
  3. lexically enclosing classes/modules
  4. Object

The new rules entailed differences in dynamic constant lookups too:

class A
  BAR = 1
  def foo(&b); instance_eval(&b) end
end

a = A.new
a.foo { BAR }                                     # => 1

vs. 1.8:

class A
  BAR = 1
  def foo(&b); instance_eval(&b) end
end

a = A.new
a.foo { BAR }                                     # => 
# ~> -:7: uninitialized constant BAR (NameError)
# ~> 	from -:3:in `foo'
# ~> 	from -:7

See also ruby-talk:181646.

Last modified:2007/10/24 16:58:29
Keyword(s):[ruby] [1.9] [ruby2] [changelog]
References: