Gary Wright wrote:
> 
> On Mar 1, 2007, at 9:49 PM, dblack / wobblini.net wrote:
>> I guess I tend to think in terms of error handling: that is, let
>> objects call [], but catch the ones that fail, or the ones that hand
>> back nonsense (in the context) values.
> 
> Let me make the situation a little more concrete.
> 
> I'd like to define a class that accepts the following syntax for
> construction:
> 
>     A.new
>     A.new(1)
>     A.new(1,2)
>     A.new(3 => 4)
>     A.new(1, 3 => 4)
>     A.new(1, 2, 3 => 4)
> 
> So the arguments to A.new are zero or more objects followed by an
> optional hash. I can certainly look for that trailing hash via
> (Hash === args.last) but what if I don't want to lock it down to
> a Hash?

There seems to be still some ambiguity in this description. In this case:

   h = {3 => 4}
   A.new(1, 2, h)

how do you know if _h_ is intended as the third object (in the "zero or 
more objects" part) or as the optional hash?

Sometimes I have wished that the hash generated by this syntax:

meth(k=>v)

were flagged in some way, so that you could distinguish it from

meth({k=>v})

But I'm not sure that would help in this case anyway.

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407