Ruby Weekly News 19th - 25th December 2005

T

Tim Sutherland

http://www.rubyweeklynews.org/20051225.html

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 you
by Tim Sutherland.

[Contribute to the next newsletter.]

Articles and Announcements
==========================

* Blog for Ruby
---------------

Gary Allum 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 Ruby
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 would
love it if someone wanted to join me in completing the library. There
are a couple of dozen native CTI methods I still need to wrap in Ruby.
You don't have to reinvent the wheel here. Just wrap the methods in
Ruby."

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

Mark Watson 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 Thomas posted an announcement for those "Looking for that last
minute Christmas present for someone ... who doesn't program, but who
wants to know just what it is that you do?"

A bit past the last minute for Christmas now, but as a post-Christmas
present: Chris Pine's "Learn to Program" is now available in PDF form,
with physical books shipping in mid-January 2006.

* Nitro Screencasts
-------------------

George Moschovitis announced the first "screen casts" for Nitro and
Og.

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

* More "Ruby for Java developers"
---------------------------------

Tom Copeland pointed out an article on IBM developerWorks called
[Ruby off the Rails], aimed at introducing Ruby to Java programmers
outside of a Rails context.

Abstract: "Ruby on Rails is just one facet of what makes Ruby great,
just like EJB is only part of the Java enterprise platform. Andrew
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 28th
of December. Rich Morin requests (but does not require) RSVPs for it.

Image of the Week
-----------------

[Hey Ruby]

Threads
=======

Subversion on RubyForge
-----------------------

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

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

multiple blocks (unfold)
------------------------

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

"For those not familiar, unfold is basically the inverse of foldl (Ruby's
inject); in its native form (as seen in most functional languages), it
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 p.call( s )
arr << f.call( s )
s = g.call( s )
end
arr
end

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 nicer'
than the above.

Mental himself came up with the following, which uses class_eval on the
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 Mullins suggested something he'd seen in some Java code (an idiom
for named parameters):

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

Mental: "It's a little weird from a Ruby perspective, but except for being
(essentially) curried it's rather like the way you'd do it in Smalltalk."

(Also see Csaba Henk's "Multiblocks" library, which makes it easy to do
the above.)

Christian Neukirchen: "C'mon, let's do complete hylomorphisms. :)",
giving code and examples like:

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

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 Bilkovich asked what people were using Iconv for, and whether there
is anything they don't like about it. (Iconv converts between different
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 Duncan.

Christian Neukirchen 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 Bicking, in a blog post "There's so much more than Rails",
argued that Ruby "plays loose with classes and interfaces in a way that
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 second
| generation that's going to be less enthused, that's going to stare in
| bafflement at these classes that mysteriously spawn methods, and trying
| 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 they
| call it "opening a class" and think it's a cool feature. I will assert:
| we are right, they are wrong.

Matz:

| "open class" is so strong (often too strong), we can break things
| easily. In other word, Ruby trust you to give you sharp knives, where
| 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, since
| they do not have to be forced.

Stephen L. Molitor:

| Certainly Python can't be against all dynamic stuff. Ain't that dynamic
| stuff what Eckel and others *like* about Python compared to Java-`latent
| typing', etc.? And can't you make the same sort of arguments against
| 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 it's
| 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 Millam 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 Hibbs released Instant Rails 1.0 preview8, fixing a small error in
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 run
it. It does not modify your system environment. This release of Instant
Rails for Windows, but there are plans for ports to Linux, BSD, and OSX."

gonzui-emacs-0.2
----------------

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.

apt-sary-0.1
------------

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

"Using apt-sary is very easy! Only replace `apt-' with `apt-sary-'."

Object Database Access v 1.0 released
-------------------------------------

Hannes Wyss introduced "another way to map Ruby-Objects to a Relational
Database", supporting

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,795
Messages
2,569,644
Members
45,358
Latest member
TreyTritt8

Latest Threads

Top