Ruby Weekly News is a summary of the week's activity on the ruby-talk mailing list / the comp.lang.ruby newsgroup, brought to you by Tim Sutherland, with contributions from Christophe Grandsire.
|
|
http://www.rubyweeklynews.org/20051030.html
Ruby Weekly News 24th - 30th October 2005
=========================================
Ruby Weekly News is a summary of the week's activity on the ruby-talk
mailing list / the comp.lang.ruby newsgroup, brought to you by
Tim Sutherland, with contributions from Christophe Grandsire.
[Contribute to the next newsletter.]
Articles and Announcements
==========================
* Are there any lecturers or professionals...
---------------------------------------------
Daniel Lewis asked if any "lecturers or professionals" were available
to give a presentation on Ruby, or on Rails, to the Brookes Computing
Society in Oxford, England.
* Monitoring network traffic with Ruby and Pcap
-----------------------------------------------
Daniel Berger spotted an article [Monitoring network traffic with Ruby
and Pcap] on Ars Technica, written by Ryan Paul.
* OSDC (Melbourne, Australia) open for registrations
----------------------------------------------------
Australia's second Open Source Developers Conference (held in
Melbourne) is now accepting registrations. (Australia is an island to
the west of New Zealand.)
"The conference is running from Monday 5th - Wednesday 7th December
2005."
User Group News
===============
* New Haven Ruby Brigade Formed!
--------------------------------
The University of New Haven Ruby Brigade have voted to disband :-(
and re-form as the New Haven Ruby Brigade :-), for everyone in Southern
Connecticut.
See also [UNH.rb may soon become NewHaven.rb].
* Beer & Pizza SIG; 8 pm, 10/26, San Francisco, CA, USA
-------------------------------------------------------
Rich Morin announced another Beer & Pizza meeting in the San Francisco
Bay Area - "No program; just a way for folks to get together and chat
about Ruby, Rails, etc."
The meeting is (haha, was) on Wednesday, October 26th 2005.
* Gauteng.rb meetup tonight (Tuesday 25 October)
------------------------------------------------
Luke Randall foretold the first meeting of Gauteng.rb, in Sandton
City, South Africa.
* grandrapids.rb November Meeting and Preparing for December
------------------------------------------------------------
November and December meetings for the grandrapids.rb group in Grand
Rapids, Michigan were covered off by zdennis.
* VanRuby Meetup Tonight & Canada on Rails Conference Announcement !
--------------------------------------------------------------------
Nathaniel Brown announced the next VanRuby meeting (Vancouver), as
well as "Canada on Rails" on April 13th and 14th 2006; the first
Canadian conference about Ruby on Rails.
Quote of the Week
=================
* Rent-a-Matz
-------------
|> Hmm, how many of you have had Matz in your car? :D
|> Myself, Eric, some others...
|Does a rental count?
Where was rental Matz available? I'd like one.
matz.
Threads
=======
Ruby Weekly News 17th - 23rd October 2005
-----------------------------------------
Last week we cheered James Edward Gray II for reaching a year's worth of
weeks of Ruby Quiz.
Curt Hibbs said that it was well deserved, and added that such recognition
is important, as it "provides people like James with a little extra
motivation to keep it up."
| So, the next time you're using some open source ruby project or
| benefiting from some community effort and you're thinking "this is
| really nice", don't hesitate to drop a note to the author or to
| ruby-talk saying thanks. It really does make a difference.
how private is private in ruby?
-------------------------------
Peter Ertl wondered why it was possible to 'send' a private method:
####
class MyUltraSecretKeystore
private
def key
return "nobody-should-read-this-ever"
end
end
ks = MyUltraSecretKeystore.new
puts ks.send(:key) # -> "nobody-should-read-this-ever"
####
James Edward Gray II indicated that although tools like send could indeed
be dangerous because of the ways they bypass method scope, it was a
trade-off with their sheer power.
Edward Faulkner added that Peter's choice of example indicated a
misunderstanding of the meaning of "private" :
| "private" is not intended as a security measure. It's an encapsulation
| technique. You'll find this is generally true in other languages as
| well. You can certainly subvert "private" in C++.
an explanation that Hal illustrated with a very good (and applauded)
analogy:
| I made an analogy the other day with the movie Apollo 13. Remember when
| Bacon's character had been awake for many hours and was, as he said, "a
| little punchy"? There was a toggle switch which would separate the two
| modules (and thus doom to death the other two astronauts who were
| spending their time in the other one). He taped a piece of paper over it
| saying "NO."
|
| That's how "private" works.
Jeremy Kemper mentioned that currently in Ruby 1.9 one cannot send private
methods.
But in the end privacy in Ruby can never be 100% ensured since as David A.
Black indicated, one can always reopen the class itself and redeclare the
private methods public.
What's your Ruby Number? (self.to_i)
------------------------------------
Hal Fulton offered a test to determine your Ruby number "in the spirit of
the old "purity test" and the "nerdity test" that was derived therefrom."
The instructions are "cut, paste, run. Or just cut and run."
Hal suggested that Jim Freeze should get extra points for having a last
name the same as a method in Ruby's core library, to which David A. Black
generously offered:
| We doubled our number of core-method-named people at RubyConf this year,
| thanks to the presence of Adam Keys as well as Jim Freeze.
|
| I'm still holding out for Matt Tainted? or Joe Instance_variable_get.
| And if anyone legally changes his or her last name to a core method, he
| or she will be admitted free of charge.
Ezra Zygmuntowicz:
| Hopefully we will never have a method called zygmuntowicz ;-) But I
| thought =~ was pronounced "zygmuntowicz"! ...
Joel VanderWerf: "That's it. I'm legally changing my name to <=>.
Sincerely, Mr. Spaceship."
_why:
| I think JEGII should keep his score cause he hacked it. David Black
| deserves more points, though. I ended up with 4, but only because I knew
| that I couldn't take the test in good conscience without adding a few
| questions that would severely dock points for unsavory traits.
|
| I also filled it out for Minero Aoki, as a kind of fantasy quest. And
| that really got me excited about starting an RPG based around the
| premise of being Minero Aoki. Or maybe just a flight simulator.
Ruby's GC
---------
Jeremy Tregunna asked for a technical description of Ruby's current
garbage collector.
Eric Hodel said that the short answer is "a conservative mark and sweep
garbage collector", and Matz gave the longer one:
| conservative
|
| we use system stack and CPU registers for tracing root as well as
| usual language roots (global/local variables etc.). jmpbuf is used
| to access registers.
|
| mark and sweep
|
| simple mark and sweep, but uses Knuth's algorithm to avoid crash for
| deep recursion.
Gabriele Renzi asked about the `generational' GC that he recalled was
being worked on - "are there some news or this simply never happened and
I'm crazy?"
Matz said that a generational GC had been implemented, but it had failed
to perform better than the current collector. He will try again after YARV
is merged.
TumbleDRYer (#53)
-----------------
Hugh Sasse created this week's Ruby Quiz. The task is to write a program
which takes repetitive input and creates a Ruby program that generates the
input, without the repetition. It's all about DRY: Don't Repeat Yourself.
"This quiz is about writing a program which we'll call TumbleDRYer, which,
given repetitive input, will create ruby code to generate that input, such
that the generating program has much less repetition in it."
Cleaner syntax for .map (is there already a way, or ruby2 idea?)
----------------------------------------------------------------
Ron M found himself writing code like the following all the time:
people.map { |person| person.email_addr }
This is pretty short already, but could we make it even shorter (and less
repetitive) by adding syntax like people[*].email_addr ?
The syntax could be extended to support nested arrays, so that
departments[*].people[*].email_addr would be equivalent to today's
departments.map { |dept|
dept.people.map { |person| person.email_addr }
}
Trans said that Facets supports something like this already with
people.every.email_addr, or people.%.email_addr.
What's wrong with just using map?, asked David A. Black.
Dave Burt argued that it's too verbose for simple cases, offering the
example of
result = array.map { |element| element.transform }
where the word element is written twice, compared to Groovy, where
implicit parameters enable
result = array.map { it.transform() }
David A. Black came back with a new thread, ["Readability" inflation] in
which he pondered the suggestions for changing Ruby's syntax that keep
popping up.
| I think what's happening is that people who've used Ruby for a while get
| used to it, and then they sort of shift their readability threshold. In
| other words, if you've seen this:
|
| a.map {|b| b.meth }
|
| for several years, then even though it looked beautiful and concise and
| transparent to you at first, it will start to look verbose and
| syntactically inefficient. So then you might want to have:
|
| a.every.meth {|b| (or implicit var, or whatever) }
...
| So I think there's a kind of readability inflation going on: people who
| are acclimatized to Ruby start feeling comfortable about going to the
| "next" level of line-noise and/or compactness.
|
| I'd like to sound a note of caution about this. I think it has the
| potential to disserve Ruby's interests, by moving the language away from
| the thing that has been proven to be so attractive.
James Britt had a couple of theories. The first was that early users of
Ruby were "language geeks" already, who were accustomed to a wide range of
syntaxes. The second theory is that "Ruby is a "victim" of its own
success" - users' expectations are raised because it is good for creating
DSLs (Domain-Specific Languages).
Several people said they didn't find the { |foo| ... } syntax that great
when they started with Ruby anyway.
The thread swung back to the "redundant block argument" topic of the
original thread, with suggestions like
playlist.sort_by :track_length
as an alternative to
playlist.sort_by { |e| e.track_length }
Brian Schröder proposed that a well-named argument can make the code
easier to read. Compare for example
playlist.sort_by :length
with
playlist.sort_by { |track| track.length }
This can be particularly important with a dynamically typed language
(perhaps more precisely, "latently-typed") like Ruby, where you don't have
type declarations in your code telling you what sort of objects you have.
Your editor can attest that this extra bit of verbosity has proven
invaluable when it comes to maintaining his own code - especially in
keeping track of the shape of his data-structures. (For example, that a
playlist is made up of tracks.)
New Releases
============
priority-queue 0.1.2
--------------------
Brian Schröder polished'n'released his priority queue implementation,
containing both a pure-Ruby version and a C extension.
FuseFS-0.5
----------
"Lo, another travesty was visited upon the ruby-talk community ... and
this one was named ... FuseFS 0.5!", trumpeted Greg Millam.
FuseFS allows you to define filesystems in Ruby, for example the
railsfs.rb filesystem which exposes your ActiveRecord objects as files
containing YAML data.
Changes were made to update the library to FUSE 2.4, as well as adding the
ability for filesystems to specify the sizes of their virtual files, and a
lower-level interface to FUSE (useful for streaming).
FuseFS is Linux only, for now.
RubyPhone 0.1 released.
-----------------------
Gregarican introduced RubyPhone, which allows a "TSAPI-compliant PBX
system to join a CTI environment". Mkay.
Rails 1.0 Release Candidate 3 (0.14.2): A bunch of little things
----------------------------------------------------------------
David Heinemeier Hansson announced the third release candidate for Rails
1.0, fixing a memory leak with render_component and other issues.
Instant Rails 1.0 preview3 Released
-----------------------------------
Curt Hibbs posted preview3 of Instant Rails 1.0, a "one-stop Rails runtime
solution containing Ruby, Rails, Apache, and MySQL, all preconfigured and
ready to run." (Currently Windows-only.)
Several bugs were fixed and the components were upgraded (including Rails
to 1.0 preview3.)
Nitro Spark 0.6.0
-----------------
George Moschovitis happily announced a new version of Nitro Spark, a wiki
system powered by the Nitro web application framework.
Facets 2005-10-30
-----------------
Trans announced the Halloween version of "The Proverbial Zoo-of-More for
Ruby".
"Ruby Facets is a cornicopia of extension methods and module/class
additions for the Ruby programming language."
rttool-1.0.0
------------
rubikitch released version 1.0.0 of rttool, a program for converting files
in the RT human-readable table format into HTML and plain-text.
rttool-1.0.1 was later announced.
Nitro + Og 0.24.0, Annotations, KirbyBase, SCGI, Og Evolution, Gen, Dynamic
---------------------------------------------------------------------------
CSS...
------
George Moschovitis released new version of Og and Nitro, the former being
an object-relational mapper library, and the latter a web application
framework.
A number of significant features were added.
gdiff / gpatch 0.0.1 released
-----------------------------
Brian Schröder posted gdiff / gpatch version 0.0.1 - pure-Ruby versions of
the Generic Diff binary-diff format.
See also [Ruby Quiz for building up Ruby?], which proposed this task as a
Ruby Quiz, as it will help RubyGems, which has a problem with the index
file being too large.
|