jruby - 是 ruby lambda 语法 ->这不是一个重要的考虑因素吗?
我注意到新的 lambda 语法 ->即使在最新的 1.6.4 jruby 版本中,Ruby 1.9 也不支持。所以,我猜测这种语法在 ruby 社区中并不常用。是因为语法是新的还是有其他缺点?
x = -> y { y+1 }
x.call(2)
在 ruby 1.9.1 中返回 3,在 jruby 1.6.4 中返回语法错误
I noticed that new lambda syntax -> in Ruby 1.9 is not supported even in the latest 1.6.4 jruby release. So, I am guessing this syntax is not commonly used in the ruby community. Is it because the syntax is new or are there any other disadvantages?
x = -> y { y+1 }
x.call(2)
This returns 3 in ruby 1.9.1 and gives a syntax error in jruby 1.6.4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有在 1.9 模式下运行它。
You are not running it in 1.9 mode.