Bill Page wrote:
> 
> On Mon, Oct 24, 2011 at 1:02 PM, Gabriel Dos Reis wrote:
> >
> > There is nothing reasonable about it. =A0The way that most AXIOM compilers
> > do overload resolution (even in faces of ambiguity) is to pick the first
> > from a list that makes the compilation works, regardless of whether the
> > arguments are the best or not. =A0That list does not necessarily follow
> > any principles that relates the arguments to the call, e.g. exact match
> > or requiring fewer implicit coercions, etc. =A0It is just how they happen
> > to be put on an internal list.
> >
> 
> As I recall that is not the case for function selection in the
> interpreter.  There is some heuristic which does attempt to assign a
> "weight" based on the number of coercions and other factors.

Yes, interpreter is quite different.  It is not more reasonable:
if there is valid selection of types compiler should find it
(due to backtracking), but interpreter may miss it (because
it commits early to the partial choice).
 
> > | Sometimes compiler works too much to make sense of
> > | user input, but IMHO this is not the case.
> >
> > Unfortunately, this is one of those cases. =A0We are lucky that it works
> > at all; that is why it is voodoo.
> >
> 
> In your discussion you are talking about types of arguments but
> function selection in Axiom also uses the return type. So the compiler
> gives priority to any nullary function named Zero that returns the
> proper type. No?

Gaby is right here: all modemaps are considered in internal order.
There is are hacks to prefer % to Rep, but I am not sure if they
always work.  Internal order depends on order of imports (including
implicit imports), so in principle changing order of import
statements you should be able to change obtained result.

OTOH coercions done by compiler are of trival kind -- unlike
interpreter compiler will not automatically insert calls to
'coerce' (it will call 'autoCoerce' but this seem to be defined
only for unions).

-- 
                              Waldek Hebisch
hebi...@math.uni.wroc.pl 

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to