What is the difference between ruby 1.8 and 1.9




















Viewed 30k times. Improve this question. John Topley k 45 45 gold badges silver badges bronze badges. Ash Ash Add a comment. Active Oldest Votes. Improve this answer.

Tamas Mezei Tamas Mezei 6 6 silver badges 9 9 bronze badges. Thanks for confirming JRuby uses Ruby's syntax — nanosoft. This seems to be the only answer that mentions integration with other Java code and Java threads, which seem like very important details. Brian Agnew Brian Agnew k 36 36 gold badges silver badges bronze badges. Thomas Jung Thomas Jung 31k 9 9 gold badges 78 78 silver badges bronze badges.

Ruby is a programming language. JRuby is an implementation of the Ruby programming language. I was meaning more on the lines of, why would use use native Ruby over JRuby or visa versa and why - but I voted this answer up because it does clear up some if the distinction for me.

I understand the intention of this answer, but it doesn't really respond the question. Clearly Ash was trying to ask the difference between MRI and JRuby and you could've clarified without so much nitpicking and also answer the question.

Its nice that youve gone to lengths to discredit someone's question. And its great to see you have not contributed anything to the community in the process :D. I see no mention of MRI in your answer. I guess from now on, instead of expecting an answer, I'll have to tiptoe on ice before even seeking to further my knowledge or tackle my ignorance.

Helping people is more important to me than reputation, if the author of the question says I helped him, that's good enough for me.

Using the proc method in the Kernel module. Being in the Kernel module, this method is globally available. It is basically equivalent to Proc. In Ruby 1. The Proc object lambda? Using the Kernel lambda method. Once again, this is globally available being in the Kernel module, using this method will create a Proc object, but it will be a lambda as opposed to a proc if you really need to know what the differences are at this point you can skip to the explanation :.

The implicit way. When you write a method which will accept a block, there are two ways you can go about it. The first is to simply use the yield keyword inside your method. If there is a yield in a method, but there is no block you will get an error.

It isn't really a different way, it is simply some syntactic sugar, but it is crazy looking, so worth knowing :. Procs And Lambdas In Detail. Here they are: Using Proc. This special parameter can have the same name but you will need to precede it with an ampersand. As usual, Ruby makes all of this interesting.

Let's look at Proc equality first. Asked 12 years, 2 months ago. Active 12 years, 2 months ago. Viewed times. Improve this question. Add a comment. Active Oldest Votes. Improve this answer. August Lilleaas August Lilleaas 52k 11 11 gold badges 95 95 silver badges bronze badges. I think this is incorrect. Try running the code in 1. It was probably accurate for the version of 1. I think it [at least currently] doesn't return self, either.



0コメント

  • 1000 / 1000