Hi --

On Tue, 8 Jun 2004, Jim Weirich wrote:

> David A. Black wrote:
> >>I missed what this syntax (and the other proposals) is supposed to 
> >>accomplish and the threading in this topic thread is wonky enough so 
> >>that I can't find the parent messages.  Could someone fill me in.
> > 
> > Go to http://www.ruby-talk.org/102672 and follow what's nested under
> > that and you'll get this branch of the thread.
> 
> Thanks.  Now I wish I hadn't asked.  :-)

:-)

> I know its fun to play "what if" with Ruby syntax and all, but I can't 
> help but think this is using a cannon to swat a fly.  And I'm not sure 
> it will solve Sean's problems anyways (which is more about type 
> discovery than type checking).

I tend to agree with the cannon point.  My first choice, by a wide
margin, would in fact be for no language-level frameworks to be
introduced in this whole area (types, interface compliance, etc.) in
2.0.  I would rather see people continue to work on after-market,
pure-Ruby frameworks, and let's see if they prove popular.  (This is
in general a good way to go about things, I think, but all the more
important here where we're potentially looking at a major shift in the
center of gravity of the language for a large number of people.)

> Actually, I was going to write up a proposal but saw a posting
> in ruby-talk:102752 that echoed my idea.  We need a mixin module for 
> hashable (similar to Enumerable) that implements the basic functionality 
> of hashes on the basis of a small number of primitives.  Then anyone 
> needing hash-like behavior would mixin this module and would get a fully 
>   implemented Hash interface.
> 
> Advantages:
>    * Full set of hash methods for the cost of implementing a small number
>      of primitives.
>    * Well defined semantics[1] for all the hash methods

Where's [1]?

>    * Easy to check test to see if something implements hash-like
>      behavior (obj.is_a?(Hashable)).

I know I tend to have a knee-jerk anti-is_a? reaction... but I wonder
whether there would be a way to have a method that was analogous to
Enumerable's #each -- maybe #each_key or something.  I'm not sure that
makes sense; just thinking out loud.

> I see a need for something like this for IO as well (eg. Readable, 
> Writeable).

I like -able modules a lot.  They are Likeable :-)


David

-- 
David A. Black
dblack / wobblini.net