Ruby Weekly News 19th - 25th December 2005

Ruby Weekly News 19th - 25th December 2005

Ruby Weekly News is a summary of the week’s activity on the ruby-talk
mailing list / the comp.lang.ruby newsgroup / Ruby forum, brought to
by Tim S…

[Contribute to the next newsletter.]

Articles and Announcements

 * Blog for Ruby

   Gary A. decided to blog his progress of learning programming
   through Ruby. Keep an eye on it.

 * Rubyforge project pickup?

   Gregarican started a project a couple of months ago to develop a 

telephony library (tsapi), but has recently been distracted by a
Smalltalk project.

   "While I plan to return to the project sometime later in 2006 I 

love it if someone wanted to join me in completing the library.
are a couple of dozen native CTI methods I still need to wrap in
You don’t have to reinvent the wheel here. Just wrap the methods

 * RubyPlanet.NET: please submit URLs for Ruby blog feeds

   Mark W. announced [RubyPlanet.NET] - a Ruby blog aggregator.

   Other such aggregators were pointed out, including
   [Artima's Ruby Buzz], and [PlanetRuby] (!).

   Previously, on [RubyPlanet.NET is up and running], there was
   discussion around using existing aggregators, and the
   [O'Reilly Ruby] blog.

 * ADV: Share the (Ruby) love (take 2)

   Dave T. posted an announcement for those "Looking for that 

minute Christmas present for someone … who doesn’t program, but
wants to know just what it is that you do?"

   A bit past the last minute for Christmas now, but as a 

present: Chris P.'s “Learn to Program” is now available in PDF
with physical books shipping in mid-January 2006.

 * Nitro Screencasts

   George M. announced the first "screen casts" for Nitro 


   "Nitro is a sophisticated Web2.0 framework that utilizes Ruby and
   Javascript and Og is an innovative, transparent and efficient ORM

 * More "Ruby for Java developers"

   Tom C. pointed out an article on IBM developerWorks called
   [Ruby off the Rails], aimed at introducing Ruby to Java 

outside of a Rails context.

   Abstract: "Ruby on Rails is just one facet of what makes Ruby 

just like EJB is only part of the Java enterprise platform.
Glover digs beneath the hype for a look at what Java developers
can do
with Ruby, all by itself."

User Group News

 * SF Bay Area Beer and Pizza SIG (RSVP request)

   The San Francisco Bay Area Beer and Pizza SIG are meeting on the 

of December. Rich M. requests (but does not require) RSVPs for

Image of the Week

[Hey Ruby]


Subversion on RubyForge

Tom C. posted an interesting followup to the recent
announcement of
Subversion support on RubyForge:

| It’s been about a week since we announced Subversion availability
| RubyForge - and a clear pattern has developed. Out of the fifteen
| projects that have been submitted since then, twelve of them have
| Subversion over CVS!

multiple blocks (unfold)

Mental had been pondering how to implement a nice-looking unfold in

“For those not familiar, unfold is basically the inverse of foldl
inject); in its native form (as seen in most functional languages),
takes four arguments:”

  • an initial state
  • a predicate (tests the state to know when to stop)
  • a transformer (converts a state to an output value)
  • an incrementor (converts a state to the next state)

It would look something like:

def Array.unfold( s, p, f, g )
arr = []
until s )
arr << s )
s = s )

You’d use it something like:

a = Array.unfold( 0, lambda { |s| s > 10 }, lambda { |s| s * 2 },
lambda { |s| s + 1 } )

(Resulting in [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20].)

The goal is to find a way of writing unfold so calling it `looks
than the above.

Mental himself came up with the following, which uses class_eval on
block passed to unfold, so that the calls to stop?, f and g are to a
particular object, not the current self.

a = Array.unfold( 0 ) {
stop? { |s| s > 10 }
f { |s| s * 2 }
g { |s| s + 1 }

Devin M. suggested something he’d seen in some Java code (an
for named parameters):

a = Unfolder.stop? { |s| s > 10 }.f { |s| s * 2 }.g { |s| s + 1

Mental: “It’s a little weird from a Ruby perspective, but except for
(essentially) curried it’s rather like the way you’d do it in

(Also see Csaba H.'s “Multiblocks” library, which makes it easy to
the above.)

Christian N.: “C’mon, let’s do complete hylomorphisms. :-)”,
giving code and examples like:

def fact(n)
do { |x| x - 1 }.
till { |x| x <= 1 }.
injecting(1) { |a, e| a * e }.to_a

See [Useless hack of the saturday morning] from May 2005 for more
syntactic trickery along these lines.

How are people making use of Iconv?

Wilson B. asked what people were using Iconv for, and whether
is anything they don’t like about it. (Iconv converts between
character sets.)

Andreas S. said he didn’t like how “Iconv raises an exception when it
finds characters it can not convert. I would prefer if it could be
made to
ignore invalid characters and just try to make the best of the text.”

This sentiment was “Seconded, Thirded, and Quadrupled” by Paul

Christian N. to the rescue: “//IGNORE” does exactly this.

Paul: “You sir, are a genius. That works great here.”

Diff of opinion on dynamic stuff

Pythonista Ian B., in a blog post “There’s so much more than
argued that Ruby “plays loose with classes and interfaces in a way
makes code hard to understand locally”.

| Of course nothing is inevitable, but there’s risk. And the first
| generation of programmers is usually enthusiastic; any failure is a
| personal failure, so you can gloss over those things. It’s the
| generation that’s going to be less enthused, that’s going to stare
| bafflement at these classes that mysteriously spawn methods, and
| to figure out what’s going when there’s an exception in dynamically
| generated code. You can monkeypatch code in Python pretty easily,
but we
| look down on it enough that we call it “monkeypatching”. In Ruby
| call it “opening a class” and think it’s a cool feature. I will
| we are right, they are wrong.


| “open class” is so strong (often too strong), we can break things
| easily. In other word, Ruby trust you to give you sharp knives,
| Python don’t. From the Python point of view, it’s wrong, I guess.

Joel VanderWerf:

| A chef will tell you that sharp knives are safer than dull ones,
| they do not have to be forced.

Stephen L. Molitor:

| Certainly Python can’t be against all dynamic stuff. Ain’t that
| stuff what Eckel and others like about Python compared to
| typing’, etc.? And can’t you make the same sort of arguments
| duck/latent typing that the blogger makes against open classes and
| dynamically generated code?

| Of course, he could still be correct-maybe duck typing and operator
| loading are safe enough, and open classes are too dangerous. But
| still kind of interesting that a Python guy is criticizing Ruby for
| being too dynamic, flexible and open. That’s of course the
argument of
| the static typing crowd against dynamic typing.

New Releases

ruby 1.8.4 released

Matz announced, as is traditional on the 25th of December: “Merry
Christmas! Ruby 1.8.4 has been released.”

eBay4R availability announcement

Garry Dolley created a Ruby wrapper around eBay’s web services API.

FuseFS 0.6.0

Greg M. released a new version of FuseFS, which allows you to
implement filesystems in Ruby.

rmdir now works, and FuseFS.mount_under accepts a number of options.

“Merry Hacking, and a Codeful New Year!”

Instant Rails 1.0 preview8 – very, very minor version

Curt H. released Instant Rails 1.0 preview8, fixing a small error
some sample apps from preview7.

“Instant Rails is a one-stop Rails runtime solution containing Ruby,
Rails, Apache, and MySQL, all preconfigured and ready to run. No
installer, you simply drop it into the directory of your choice and
it. It does not modify your system environment. This release of
Rails for Windows, but there are plans for ports to Linux, BSD, and


Rubikitch updated gonzui-emacs, which is an Emacs interface to the
source-code search engine “Gonzui”.

gonzui-emacs is written in EmacsRuby.

This release is asynchronous and has colour.


rubikitch released the first version of apt-sary, a tool for Debian
that provides a “MUCH FASTER” way of doing “apt-cache search” and
“apt-file search”.

“Using apt-sary is very easy! Only replace apt-' withapt-sary-’.”

Object Database Access v 1.0 released

Hannes W. introduced “another way to map Ruby-Objects to a
Database”, supporting

 * transparent loading of connected objects
 * index-vectors
 * transactions
 * transparently fetches Hash-Elements without loading the entire