[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] [#261 Strange matrix addition] Axiom interpret is diff
[Axiom-developer] [#261 Strange matrix addition] Axiom interpret is different from SPAD by design
Fri, 03 Feb 2006 09:45:29 -0600
I agree with Martin that we should expect that (most) SPAD functions
will work when written as function definitions in the Axiom interpreter
but usually not the other way around. Although the distinction between
interpreter and compiler is a bit ambiguous because functions are usually
also compiled to lisp in the Axiom interpret, where possible. The Axiom
interpreter however makes assumptions about types, performs "mode matching"
and does automatic coercions in an attempt to releave the user of having
to specify such details. This is not part of SPAD or Aldor semantics.
This "mode matching" mechanism in the Axiom interpreter is what gives
the perhaps unexpected result above. I think it goes something like
this: In trying to resolve the meaning of the '+' operator, mode
matching searches for coercions of the operands such that the signature
of some known (exposed) function matches the resulting signatures of
the operands and the type of the desired result (if specified). It
then applies the coercions and function of the first match it finds.
I think this behaviour is fundamental to the design of the Axiom
interpreter and cannot/should not be changed. However in a sense it
is/was only an experiment. There does not seem to be any sound and
complete theory of how it should work in practice. (I think there
is a paper about the theory of automatic coercions in the AxiomPortal
reference library.) In particular, it is difficult to predict in
advance the affect for providing the interpret with certain coersion
paths since the mode matching search can become quite complex -
as the example above illustrates. But it is also essential for basic
use of the interpreter such as:
where we see the interpreter does behave in a simple and expected
So in short: I think we need a theory, and then we need to review
and edit Axiom's current system of coercions to try to ensure that
the Axiom interpreter's behaviour is more intuitive for new users.
As an interim measure, it might be nice if we had a more user-friendly
way to display the results of the mode matching than the obscure
result of ')set output bottomup on'.
forwarded from http://wiki.axiom-developer.org/address@hidden
|[Prev in Thread]
||[Next in Thread]|
- [Axiom-developer] [#261 Strange matrix addition] Axiom interpret is different from SPAD by design,
Bill Page <=