From: Eric Mahurin Date: 2005-05-27T02:34:21+09:00 Subject: will callable objects be more general in Ruby 1.9? In Ruby 1.9 CVS, you can "call" local variables. i.e. f = {|*args,&block| puts(*args);block[]} f("hello","world!") {puts("bye")} The last statement is equivalent to: f.call("hello","world!") {puts("bye")} I see multiple applications of these callable objects outside of just calling a Proc (how about call=new in Class, call=each in Enumerable, or call=clone in Object). Unfortunately what's in 1.9 lacks some generality. These don't work: 1. Allowing "f" to be an expression rather than just a local variable: {|*args,&block| puts(*args);block[]} ("hello","world!") {puts("bye")} 2. Allowing the () to be optional if a block is specified: f {puts("bye")} Any plans making these callable objects more general? Another option for getting syntax like #1 above would be to allow the [] operator to take a block ("f" can already be an expression): f["hello","world!"] {puts("bye")} __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com