Hildo Biersma wrote:
> 
> > The other way C++ allows you to overload a named function is
> > by return type.  This document is a companion piece to
> > a similarly named one about protoypes.  It replaces old Perl's
> > "wantscalar" and "wantarray" kluges, which can now be deprecated,
> > with a cleaner interface allowing decisions which are possible to
> > make at compile time to be made then.
> 
> C++ emphatically does *not* support overloading on return type only.
> That has a very simple reason: unlike Pascal, C++ does not force you to
> assign the result of a method or function call to a variable, so it
> cannot always tell what you're doing.
> 
> The same reason pretty much goes for perl: if I have array and hash
> versions of a function, how can it tell which one to call if I don't
> assign the results?
> 
> Hildo

This is true.  C++ does not support overloading by context.  According
to a reference on why not, Algol68 did.

An indication of which version to call in ambiguous cases  will be required,
and I will add it to 98 as soon as the archangel Jon whispers it to me
or something like that.

I don't see the possibility of ambiguity as reason to give up, just
as reason to clearly define a tiebreaking protocol.


-- 
                          David Nicol 816.235.1187 [EMAIL PROTECTED]
:wq

Reply via email to