Hello --

On Sat, 5 Jan 2002, Massimiliano Mirra wrote:

> On Sat, Jan 05, 2002 at 04:53:14AM +0900, Adam Spitz wrote:
>
> > I want to see a big collection of all the methods that people have
> > added to the built-in Ruby classes. I want to look over them and
> > take the ones that look cool and play with them myself and improve
> > them if I can.
>
> Well, at least your snippet has earned a one way ticket to *my*
> xenumerable.rb.  each_send is a great idea.
>
> Which leads me to: this is a context where size does *not* matter.
> Sometimes after banging my head against the wall for an hour to solve
> a problem, I come up with a one- or two-liner that solves it elegantly
> and go ``Cool!''.
>
> Then I think that it would be nice to share it with others, yet the
> RAA is no place for one-liners and the list doesn't seem appropriate
> for snippets unless requested (for one thing, more people could easily
> post very similar snippets in time).  This is not limited to
> x[object].rb's but also regards idioms and solutions not pertaining to
> builtin classes extension.

See [ruby-talk:14556] for a kind of cry-from-the-deep about this from
last May.  I continue to think that we're underutilizing what we've
got.  That may be true in other language communities too -- but Ruby
lends itself to... well, like I said, see 14556 :-)

> Does anyone see such a repository of ``molecules'' as possible?  It
> looks like it sits in the same domain of RubyGems, RAA.succ etc.,
> i.e. a system to store and classify some things against various
> parameters and allow people to post, get and update such elements.

I definitely see it as possible, especially if you're talking about
adding methods rather than changing methods.  Actually I was aiming
for both in Ruby Behaviors (see [ruby-talk:18803], also my talk on
http://www.chadfowler.com/rubyconf.html), which may be why that
project is still resting comfortably in a pre-alpha-ish stage.  (Aside
to David Simmons: finished selector namespaces for Ruby yet? :-)

I've talked to Ryan "Ruby Gems" L. quite a bit about the relation
between Ruby Gems and Ruby Behaviors (the latter being not necessarily
identical to what you're envisioning, but relevant enough for
comparison), and our feeling (Ryan? yes? :-) has always been that
something like a Behaviors package, or cluster of small additions to
Ruby, could itself be packaged as a Gem.  So it wouldn't have to be a
different or parallel distribution system -- it could just essentially
be 'require'd at runtime like any Gem/library/etc.  Then behind the
scenes, or before the fact, so to speak, it could all have been
organized and cleared for namespace conflicts and so on prior to
becoming a Gem.

I have to admit, though, I wouldn't mind seeing more code-sharing at
the snippet level, with some at least serviceable management of
namespace conflicts, even before all this packaging stuff is sorted
out.


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav