[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] "has" and "with" (was curious algebra failure)

From: Bill Page
Subject: Re: [Axiom-developer] "has" and "with" (was curious algebra failure)
Date: Mon, 13 Aug 2007 12:20:59 -0400

On 8/13/07, Gabriel Dos Reis wrote:
> ...
> When compiling the default definition of ** for Monad, the compiler
> notices that expt comes from RepeatedSquare(S), where S is the
> parameter of type Monad to Monad&.

This use of S is confusing to me. The spad code says:

   import RepeatedSquaring(%)

The S that I see is the *formal* parameter of RepeatedSquaring. It's type is

    SetCategory with "*": (%, %) -> %

as defined in repsqr.spad. But in Monad the parameter % in

   import RepeatedSquaring(%)

refers to some domain (currently unknown) that has type Monad.

How can I reconcile that with your statements about S above? Is the
"S" to which you refer some kind of dummy?

> If compiles all arguments x and n fine.
> Then it has to compile the package RepeatedSquare(S) -- as if it were
> a function call, since all instantiations are function calls.  To achieve
> that it asks the question whether S (of type Monad) is coercible to
>    SetCategory with "*": (%, %) -> %
> And the definition of coercible does not permit to return "yes".

But certainly it must return "yes" in an unmodified version of the
Spad compiler or (perhaps)  what needs to be coercible is not S of
type Monad but rather the dummy %. It's type is the category-value of

  SetCategory with
       "*": (%,%) -> %
       rightPower: (%,PositiveInteger) -> %
       leftPower: (%,PositiveInteger) -> %
       "**": (%,PositiveInteger) -> %

which certainly is coercible to

   SetCategory with "*": (%, %) -> %


Is it possible to trace how coerce is called in an unmodified Spad
compiler that compiles Monad without an error message?

Bill Page.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]