30th January - 5th February 2006

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.

Articles and Announcements

  • Seeking Continuations Links
  • ‘Playing Around with Continuations’ is a project being put together by James Edward Gray II and some others. “As a start, we are collecting any resources we can find about them.”

    Some links were posted.

  • Rolling with Ruby on *Instant* Rails - "New" Tutorial
  • Bill Walton, with permission, updated Curt Hibb’s “Rolling with Ruby on Rails” tutorial “to make it 100% keystroke-for-keystroke, window-for-window accurate for someone using this same tutorial for InstantRails Release 1.0”.

  • Rails Recipes Beta Book now available
  • Dave Thomas: “I’m delighted to announce that Chad Fowler’s new book, Rails Recipes, is now available as a Beta Book.”

    This is a great title for folks who know Rails, and for folks who want to get the most out of Rails. It contains detailed recipes for doing real-world things with Rails, all illustrated with working code. Some examples are drawn from Rails 1.1, the rest from Rails 1.0.

    If you’re used to other recipe-style books, you’ll be surprised by the depth Chad goes to in this book. These aren’t the usual “How to substitute a string into a template” recipes. Instead, you’ll find code to solve the kinds of problems you face in real applications: using multiple databases, handling sortable lists, using tags, and many, many more.

    “If you also order the paper book, it’ll ship just as soon as we have it in stock (probably sometime in May or June, but you know what authors are like…)”

    Thomas Kirchner: “Quick and surprisingly receptive?”
    Pat Eyler: [...] “he forgot good looking.”
    Dave: “and honest”

  • Press release: Ruby on Rails Bootcamp in Germany, April 10-14, 2006
  • I haven’t seen this posted to the list, but it has appeared in my inbox twice now on the day before I send out the RWN newsletter :-)

    Big Nerd Ranch Europe have a Ruby on Rails “Bootcamp” in Germany, on April 10th – 14th.

    The course instructor is Rails core developer / 37signals employee, Marcel Molina.

User Group News

  • BYU RUG (Utah): February 8 meeting
  • Pat Eyler said that the BYU RUG (Brigham Young University, in Utah) are holding their February meeting on Wednesday 8th. It features Eric Hodel, who has come from Seattle to talk about all sorts of goodness.

    “We’d like to thank Sleep Inn of Provo, who’ve graciously sponsored this meeting, and are providing accomodations for Eric on the night of the meeting.”

  • Ruby in Rome: First Meet-up of the Ruby Social Club in Rome
  • Chiaro Scuro announced the first meeting of the Rome Ruby Social Club, on February 9.

    “If anyone of you is planning to join, please let us know a couple of days in advance so that we can arrange for a bigger table.”

  • Call for Participants: Koeln (Cologne)/Bonn area Ruby User Group
  • Josef ‘Jupp’ SCHUGT asked if anyone was interested in forming a Cologne/Bonn area Ruby User Group (in Germany).

    Stephan Kämper said Germany also has Hamburg.rb, and a Munich group is possibly in the formulation process.

  • Houston RoR/Rails Group
  • Keith Lancaster said some Houston users were trying to put together a Ruby (and RubyOnRails) group.

    “If you are in town and would like to drop in, we are meeting at The Daily Grind on Washington Ave. at 10:00AM Saturday 4 Feb.”

  • Phoenix Ruby Users Group February Meeting
  • James Britt announced the February meeting of the Phoenix RUG: Monday, February 13.

  • Toronto RUG Meeting - 5 Feb 2006
  • “Once again the Toronto Ruby User Group is meeting at the Linux Caffe in Toronto at 1pm on Sunday 5 February 2006.”—Mike Stok.

Quote of the Week

  • Indentation vs. "end"s
  • I think we can learn a lot from programming languages and Python. 
    First off, we should be writing in a fixed space font so we 
    can take visual cues from spacing more easily. 
    Next, why do we need periods at the end of a sentence 
    when we know that two spaces after a word mean 
    that the previous sentence just ended  Doesn't 
    that make sense  And do we really need caps at 
    the beginning of a sentence  we know all sentences 
    are capitalized and we have just defined that 
    two spaces before a word means that it is at the 
    beginning of a sentence  next we should look at 
    spelling  double consonants don't realy add to 
    the meaning  so begining now we spel words by 
    droping repeated consonants  just look at al 
    these great benefits we can learn from python 
    self.we self.just self.need self.to self.learn 
    self.to self.ignore self.certain self.aspects 
    self.that self.may self.cary self.over

    —Jim Freeze

    [Don’t be mean to our Pythonista friends :-) ]

    This “indentation vs end” thread actually featured a surprising number of interesting posts, including a recollection by Hal Fulton that “really old” (pre- August 1994) versions of Ruby let you optionally write “end def”, “end class”, etc. instead of just “end”, “end”.

    “When modifiers were introduced (x if y, x while y, etc.) parsing became difficult and they were dropped.”

Threads

Splitting the Loot (#65)

James Edward Gray II created this week’s Ruby Quiz.

“You, and your trusty band of adventurers, have stumbled upon a hidden cache of rubies! (What luck, eh?) Not all gems are created equal, so you sneak them home and take your time evaluating the stones. The find was an equal effort, and you’re all horribly greedy, so you must find a fair system for dividing up the gems.”

Work around for "Bignum out of Float range"?

Sam Kong:

def calc(n)
  (2 ** n) * (5 ** 0.5)
end

puts calc(10000)
# => warning: Bignum out of Float range 

Axel said that the square root of 5 has infinitely many decimal digits, however BigDecimal can be used if you limit the precision:

require 'bigdecimal'
def calc(n, precision)
  (BigDecimal('2') **  n) * BigDecimal('5').sqrt(precision)
end

puts calc(10000, 10) # => 0.44610[several lines of digits]*10^3011

Axel added that “continued fractions” can be used if accurate multiplication by square roots is necessary.

ruby-dev summary 28206-28273

Minero Aoki summarised the Japanese list ruby-dev.

An interesting item is Nobu’s “ANDCALL operator” proposal. (This was also discussed on ruby-dev’s English equivalent, ruby-core.)

Having a notation like “&?”, it would be used as follows:

    if a[1] and a[1].strip.empty?
                ||
    if a[1] &? strip.empty?

    h["key"] and h["key"].dispatch
                ||
    h["key"] &? dispatch 

“The motivation of this operator is to avoid duplication of expression.”

Takaaki Tateishi proposed having the nil? method take a block, instead of adding more syntax.

ruby-talk readers followed up with their feelings.

Daniel Berger: “Yuck. Looks like a hack from Perl6. Not Ruby-ish.”

Eric Hodel said Takaaki’s method should be ‘not_nil?’, while your editor quite likes ‘and’:

@h['key'].and { |v| v.dispatch }
@h['key'].and(:dispatch)

Joel VanderWerf suggested h["key"].?dispatch as the syntax. “It’s more visually similar to the ordinary method call”.

Ruby Syntax: 'initialize' versus 'init'

Clint Checketts wondered why Ruby uses ‘initialize’ instead of the shorter ‘init’?

Matz: “It can be very critical when the name of initializing method conflicts with others, so that I chose “initialize” to avoid potential problems. Besides that, the name was derived from T language (Scheme dialect).”

Hardcore Ruby kurser i Danmark (Ruby courses in Demark) ?

mortench: “Jeg leder efter et kursus i Ruby for erfarne udviklere, som kender java/c++/c# el. lign. og som gerne vil komme hurtigt og rigtigt igang med Ruby. Jeg har dog ikke hørt om nogle kurser i Danmark. Er der nogle ? “

baalbek replied, “Hvis du kjenner allerede C++/Java etc, så skulle Ruby være enkelt å lære seg selv, bare få tak i Programming Ruby (Dave Thomas), så burde du være på vei! “

foo.h -> foo.rb

Ara T. Howard pondered whether someone had created a parser for producing Ruby DL bindings from .h files (C header files).

DL is a Ruby library that makes it easy to call C code from Ruby. Hal’s aim is to automatically convert C header code like

struct timeval {
  time_t          tv_sec;         /* seconds */
  suseconds_t     tv_usec;        /* microseconds */
};

into Ruby code

require "dl/import" 
require "dl/struct" 
module LIBC
  extend DL::Importable
  Timeval = struct [
    "long tv_sec",
    "long tv_usec",
  ]
end

MenTaLguY: “Well, you’d need more than just a parser, since you’d often have to pick up on typedefs and other type information.

I wonder whether writing an alternate swig backend or something might work.”

Proposal For New Ruby Mailing List Subjects

Zed Shaw ‘proposed’ new subject indicators for ruby-talk. A couple of quotes:

“Why not Sailor Moon styled bura-sera?”

“ruby-rails-sheep—No, not a place for former Java sheep to come and turn their brains off again, but rather a place for people to discuss the constant topic of table pluralization.”

Torn in two - Pythonist

Doug Bromley: ” I’ve been hovering in this mailing list for a time just to get a feel for the community. I must say I’m pretty impressed. Its friendly, very active and I’ve learnt a lot.”

“However”, Doug continued, as a Pythonist he finds some of Ruby’s syntax unusual. “Should I jump ship? Has anyone else been in my position and taken the plunge by converting?”

Phil Tomson:

Don’t think of it as jumping ship. Think of it as going over to check out the other side of the catamaran.

This dynamic-language catamaran has many pontoons and you are free to move about them. Just remember to keep your lifejacket on.

Ruby jargon and slang

Hal Fulton announced that he is putting together a list of jargon used by the Ruby community, and asked for contributions.

“I have such things as: duck typing, threequal, spaceship operator, singleton method, singleton class, splat or unary unarray, multiple or parallel assignment, and (ehh) eigenclass.”

mental: “You’ve neglected chunky bacon.”

Daniel Nugent: “Chunky Bacon isn’t jargon, it’s a battle cry.”