axiom-math
[Top][All Lists]
Advanced

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

[Axiom-math] Re: [Axiom-mail] Dynamically constructed return types


From: Martin Rubey
Subject: [Axiom-math] Re: [Axiom-mail] Dynamically constructed return types
Date: Fri, 7 Jan 2005 19:08:26 +0100

Dear Marcus,

* PLEASE subscribe to axiom-math. It is pretty low volume and adresses exactly
  the type of questions you tend to ask *

Marcus Better writes:
 > Hi all,
 > 
 > I got stuck trying to write a spad function that will take an argument of a
 > certain type T, construct from this some other type S, and return an object
 > of type S. 

Indeed, it seems that this is a weak point of Axioms static typing
philosophy...

 > I am using the "Any" type to do this, but I have a problem extracting and
 > using the type and object encapsulated in the Any object.

Could you make this more precise? The best thing would be a nearly working
example. I started to make your example below compile, due to lack of time I
took a shortcut -- I hope I captured the essential. (I couldn't get taylorRep
to work)

)abbrev package FOO Foo
Foo(K: CommutativeRing, ULS: UnivariateLaurentSeriesCategory K): 
      Exports == Implementation where

   Exports == with
     f: ULS -> Any

   Implementation == add
     
     SUP ==> SparseUnivariatePolynomial

     f(x) ==
       -- Compute some equation over K.
       eq := monomial(1,2)$SUP(K) - coefficient(x, order x)::SUP(K)

       -- Create an extension L of K.
       L := SimpleAlgebraicExtension(K, SUP K, eq)

       coerce(1::K::L)$AnyFunctions1(L)

Could you now specify in which situation you want to call f and what you want
to do with it? I guess it is a compiler issue?

Martin





reply via email to

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