Daniel Azuma |
||
|
Ruby Version Numbers Done Right?
Posted on Mon, Nov 30, 2009, at 11:53 PM
(3 comments)
Tags:
ruby
Summary: Introducing versionomy, a new rubygem offering robust parsing, interpretation, manipulation, and comparison of version numbers. It features an adaptive parser with enough flexibility to handle a variety of syntaxes, including prerelease (e.g. alpha, beta) syntax, patchlevels, and nonstandard delimiters. Try it out and feel free to leave feedback. The Challenge of Version NumbersHow do you compare version numbers? Suppose you have some ruby code that requires Ruby 1.8.7 or later, and won’t work under 1.8.6. Well, I’ve seen a lot of code that does something like this:
Treating the version number as a string works well enough… that is, until it doesn’t. If… Ruby 1.8.7 IO#select threading bug
Posted on Tue, Aug 25, 2009, at 12:12 AM
(4 comments)
Tags:
ruby
I just spent most of a day tracking down a rather obscure Ruby interpreter bug involving multiple threads calling IO#select. Basically, what happens is, if you are running Ruby 1.8.7p160 through 1.8.7p174 (and possibly some later versions), and you have multiple threads calling IO#select on different and disjoint sets of IO objects, the calls may fail to return results even though there are results to return. I reported the bug on RedMine here along with a possible strategy for fixing it. It’s fairly deep in the thread handling C code of MRI 1.8.7. It does not appear to affect MRI 1.9.x. Earlier versions of 1.8.7 (e.g. p72) also appear to be immune. I happened upon this because I use Net-SSH fairly… Blockenspiel 0.2 released with Ruby 1.9 and JRuby support
Posted on Thu, Apr 16, 2009, at 11:21 PM
(1 comment)
Tags:
ruby
I just pushed out a new version of Blockenspiel, a rubygem that provides tools for writing DSL blocks. See the Blockenspiel docs for more details. Changes include:
To install the latest version (0.2.1), use
Note that I’m not using Ruby 1.9 or JRuby regularly (yet) so please let me know if you find problems, especially on those platforms. All I know is that the gem builds successfully and the automated tests pass… Implementing DSL Blocks
Posted on Wed, Oct 29, 2008, at 07:10 PM
(6 comments)
Tags:
ruby
A DSL block is a construct commonly used in Ruby APIs, in which a DSL (domain-specific language) is made available inside a block passed to an API call. In this paper I present an overview of different implementation strategies for this important pattern. I will first describe the features of DSL blocks, utilizing illustrations from several well-known Ruby libraries. I will then survey and critique five implementation strategies that have been put forth. Finally, I will present a new library, Blockenspiel, designed to be a comprehensive implementation of DSL blocks. An illustrative overview of DSL blocksIf you’ve done much Ruby programming, chances are you’ve run into mini-DSLs (domain-specific languages) that live inside blocks…. |
Recent
Tags
Random blogs
|
|