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: Marcus Better
Subject: [Axiom-math] Re: [Axiom-mail] Dynamically constructed return types
Date: Mon, 10 Jan 2005 13:23:23 +0100
User-agent: Mozilla Thunderbird 0.9 (X11/20041124)

* PLEASE subscribe to axiom-math.

Ok, ok, done that... :-)

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

Yes, this would probably be easily done with true weak typing (as in Smalltalk perhaps), but I wonder whether it should not be possible in Axiom too.

After all, when I call my function (returning Any) from the command line interface, it correctly decapsulates the Any object, so that I can do algebra on the returned value. I am trying to imitate some of this magic in my spad program.

Could you make this more precise? The best thing would be a nearly working
example.

I will try to provide one later, but for now I will try to explain using your code.

Could you now specify in which situation you want to call f and what you want
to do with it?

Ok, so f returns a value y of type L. Now the caller wants to do some arithmetic with y, such as checking if it's zero or not.

In my code, f would actually return a Laurent series over L. The caller would then do some linear algebra on the coefficients of this series, and eventually calculate the rank of some matrix over L.

For this, the caller really only needs to know that the returned value belongs to a domain having a certain category, CommutativeRing, or Field, say. That should make it possible to do some matrix calculations without knowing the exact type of the code. This sounds like it should be simple enough?

So, how can I declare the function f to return "CommutativeRing"?

In usual statically typed languages like Java I would specify a return type of Ring, which would be an "interface" definition (or abstract base class in C++). Can I do the same thing in Axiom using categories?

Marcus




reply via email to

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