What version of Ruby to use in Why's (Poignant) Guide to Ruby
I've been following Why's (Poignant) Guide to Ruby for the past few days, and I've noticed some problems with running his examples.
I'm at a crossroads now as to whether I've made a few typos that I can't seem to catch, or that my Ruby version is incompatible.
I'm running Ruby 1.8.6 (Win32), and I noticed in Chapter 5 in the irb prompt mention of Ruby 1.8.3.
Before I drive myself mad; is it just me or do I need to downgrade to 1.8.3?
Along those lines, how hard would it be to port the code up to 1.8.开发者_Python百科6 in the event that they aren't compatible?
I'm pretty certain you will be fine. I have never really worried about point releases as long as the "branch" version remained the same. I think you will find that 99.9%, if not 100%, of the things you are working through in why's guide will still work no matter which version of Ruby 1.8 you use.
Here is a snippet from the Ruby 1.8 branch policy from the ruby-lang issue tracker site:
The 1.8 branch, or in general, a "stable" branch is developed and maintained for most casual use by average ruby programmers. Besides fixes for security problems and run-time bugs, there can be performance improvements, feature enhancements and library updates made on the branch. Those kinds of aggressive changes may occur, however, only on condition that backward compatibilities and run-time stabilities are retained to a high degree.
...
Committers are allowed to make a commit on a stable branch without explicit approval from the branch manager, as long as it does not break any backward compatibilities, that is, it does not delete or change any existing features.
A list of exceptions is as follows. A commit may break backward compatibilities only when all of the following conditions are met:
- It only affects: 1) behaviors which contradicts with the document, 2) internal, unpublicized interface, 3) undocumented features, 4) undefined behaviors, or 5) presumable misuses.
- The new behavior will not change again in nor contradict with the next major version series of Ruby.
- If it is assumed that it may silently affect existing code in a subtle way, sufficient information and/or a support tool must be supplied with to help users fix their existing code.
- It is well considered and reviewed in public and approved by the branch manager.
- It is well documented and announced in ChangeLog and NEWS as soon as it goes in.
1.8.6 shouldn't pose any problems. Poignant Guide readers haven't been using 1.8.3 for many years, and _why was still writing the guide when he was using much later versions. So I don't believe there are any compatibility problems.
精彩评论