On Thursday, January 30, 2003, 7:44:42 PM, you (mailto:[EMAIL PROTECTED]) wrote:
> On Thu, 2003-01-30 at 13:13, Garrett Goebel wrote:
> Let me switch that one around for you:

>         class MyContainer {
>           method index($object) { ... } # index by any scalar object
>           method index(int $ind) { ... } # index by a number
>         }
>         my MyContainer $x;
>         $x.index($!);

> What does *that* do? Ultimately, C<$x[$!]> is no different, and if we
> have a resolution for one, we have a resolution for the other.

> What's more, even if we do decide not to unify arrays and hashes (as I'm
> assuming we will), I'm pretty sure we still need to answer this
> question.

> Options include:

>         * Run-time error
>         * Default to most generic type with warning
>         * Default to most generic type without warning
>         * Default to most specific type (huh?) with warning
>         * Default to most specific type without warning

> I'm not sure what I meant by "most specific", but it sounded like that
> should be one of the options. Can anyone else read my mind better than I
> can? :)

While I wouldn't claim to know anyone's mind (I have enough problems with my own
:-), I think the "huh?" there is quite correct. Having looked at the C++
solution to this (for both overloading and template (partial) specialisation
resolution I don't think it would be a good idea to go anywhere near this. In
fact we should all run away very fast. Very very fast.

However just defaulting to the most generic (i.e. typed) is likely to lead to
action at a distance if the set of overloads is changed... so a warning would be
a really good idea.

-- 
Richard
mailto:[EMAIL PROTECTED]

Reply via email to