On Tuesday 02 December 2003 05:38, Tanaka Akira wrote:
> I searched 183 emails in the archive of ser-rexml / germane-software.com
> but I couldn't find a such question.

What were your search terms?  Try searching for "whitespace" or "raw".  Those 
are two common attributes controlled by the hash arguments.

> Would you show Message-IDs of such emails?

I have a better idea:  how about you do whatever you want to do with your API? 
I don't need to prove to you that this is troublesome because I don't care 
what the API for open-uri looks like.  I was providing advice based on my 
experience, and if you choose to ignore the advice, it doesn't affect me.  
It'll affect your users, and it'll affect *you*.  Its your API, and seeing as 
I don't use the library, I don't have a vested interest in how it looks.

The real problem with APIs for libraries is that once you define them, they're 
very, very painful to change.  If you decide in the future, like I did with 
REXML, that hashes were the wrong decision, too bad.  The only option is to 
keep them (legacy code... auugh!) or break all of the applications that use 
your library.  The second option really is a last resort.  This is the *only* 
reason why REXML still has hash parameters in its API.

Note that this applies not only to issues like hashmap parameters, but to any 
other API decision.  There are a few API decisions that I regret about REXML.  
I think its an occupational hazard when authoring libraries.

> > The problem is in handling polymorphic methods.   Ruby doesn't support
> > method polymorphism, meaning that to have method foo() that takes EITHER
> > a string and an optional int, OR a Foo and an optional String and an
> > optional int, I have to produce some pretty complex code to handle the
> > various possible states.
>
> There is no such problem in open-uri, at least now.

I wasn't talking about open-uri.  The subject was that having neither 
polymorphic methods or named variables in Ruby leads to problematic method 
implementations.  This is a language issue, not an library issue, and it'll 
be addressed in Ruby 2 (hurrah!).  Ruby isn't the only language that has this 
issue; many loosely typed languages have the same hurdle, since polymorphism 
is often based on argument type.

--- SER