What's discouraging you from writing ruby 1.9-specific code? [closed]

旧时模样 提交于 2019-12-01 20:19:21

问题


So far, I've been merely using YARV (ruby 1.9) as merely a faster implementation of ruby than ruby 1.8, and ensured that all of my code is backwards-compatible with ruby 1.8.6. What circumstances, if any, are stopping you from writing 1.9-specific code?

One reason per answer.


回答1:


Also, if we're talking about rails, then the problem there is the compatibility of gems/plugins with ruby 1.9. I'm sure everyone who wants to upgrade to 1.9 keeps an eye on isitruby19.com




回答2:


The first release candidate for Ruby 1.9.2 is due end of May and I believe many are waiting for 1.9.2 to hop on the 1.9 train.

Not really an answer to your question, but to start writing code uses 1.9.2 methods now, you can require "backports" and most features will be available to you, even in Ruby 1.8.6 (albeit not nearly as fast, of course).




回答3:


I wish I could forget about Iconv when handling unicode data, like this:

Iconv.conv("utf-8", "utf-16le", blob).split("\n")

but so far I could not find good examples/tutorial of 1.9 unicode handling yet.




回答4:


Nothing is discouraging me. I've been using Ruby 1.9.1 for everything I do for close to a year now and had few problems. My major gems require 1.9 for various reasons (easy UTF-8, fibers, etc.) and I've felt no qualms about it. For some other trivial gems I might make a token effort to keep them 1.8 compatible, which mostly just means not using the cleaner new hash syntax.

1.9 is the current Ruby. I can see needing to keep the old Ruby around for legacy code that isn't worth updating, or having a preference for an alternative Ruby (JRuby, Rubinius, etc.) -- but it truly baffles me why so many people are still starting new projects in the slower, obsolete Ruby 1.8.x line.




回答5:


In many operating systems, it is easier to install ruby 1.8 than ruby 1.9.

  • Some distributions of Linux have packages for 1.8 but not for 1.9.
  • OS X has ruby 1.8.7 pre-installed. 1.8.7 runs the ruby 1.9 language.
  • The one-click installer for Windows is ruby 1.8.



回答6:


I don't know Ruby so well to distinguish 1.8 from 1.9 ( well that's my reason :P )



来源:https://stackoverflow.com/questions/2688002/whats-discouraging-you-from-writing-ruby-1-9-specific-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!