On Mon, Apr 7, 2008 at 3:58 PM, Waldek Hebisch wrote:
>
>  Bill Page wrote:
>  >
>  > Francois Maltey,
>  >
>  > As I explained in my original email, it is not currently possible to
>  > compile this code in any version of Axiom. In that email thread
>  > Gaby has stated that he considers this a bug in the SPAD
>  > compiler.
>  >
>  <snip>
>
> > But *if* it
>  > was possible to compile, then the correct syntax for this would
>  > be:
>  >
>  >       (f= (_+$S) => ...
>  >
>  > where '_+$S' refers specifically to the + operation in the
>  > package/domain S.
>  >
>

Here is an example that actually works!

http://axiom-wiki.newsynthesis.org/SandBoxMyReduce

>  I am not sure if we should consider this as a correct syntax.
>  Namely, '_+$S' looks underspecified, at least in principle S
>  may contain multiple '+' operations. It seems that we currently
>  have no syntax to require specific signature from a domain,
>  so one probably should use something like (untested):
>
>     getfun(f :(S, S) -> S) : (S, S) -> S == f
>
>  and use as test 'f = getfun _+$S'.

Yes! That is the right idea but really what we need is for the SPAD
compiler to choose a reasonable signature for the '=' operation.
Probably everything would work-out (almost) ok if the built-in
'Mapping' domain exported an operation like this:

  (f:(S,S)->S) = (g:(S,S)->S)):Boolean ==  EQ(f,g)$Lisp

>  If the version with 'getfun' does not compile, then I would
>  consider it a bug.

Your suggested code only fails to compile because of the missing
definition of equality for functions.

>  OTOH I am not sure if it is supposed to actually work --
>  equality of  functions is a tricky business.  One can
>  define reasonable equality for functions, but this
>  basically disables some optimizations.

I think that in principle one can simply compare the names of the
operations. But the complication is that the "names" of some
operations in SPAD are not fully determined until their first
application during run-time. There is a need to resolve calls to
'newGoGet' before comparing the names. One way to do this is simply to
apply the functions to some arguments at least once before doing the
comparison. E.g.

  f(0,0)=(0+0)$S and (f = _+$S) => return 0$S

Here both 'f' and '+' are applied to a member of S before testing the equality.

If the function equality operation were actually exported by Mapping,
then there would need to be some more "magical" way to do this inside
the operation itself.

>  And, when I write "one can define", this assumes
>  complete low-level control of the implementation --
>  for example Lisp can defeat our efforts.
>

Could you explain further how you think Lisp might affect this?

Regards,
Bill Page.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to