[Top][All Lists]

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

Re: [Axiom-developer] about Expression Integer

From: Ralf Hemmecke
Subject: Re: [Axiom-developer] about Expression Integer
Date: Mon, 20 Feb 2006 18:57:09 +0100
User-agent: Thunderbird 1.5 (X11/20051201)

Hallo Gaby,

On 02/20/2006 06:15 PM, Gabriel Dos Reis wrote:
Ralf Hemmecke <address@hidden> writes:


| > But eventually in order to program in Axiom, it is essential that
| > they gain a full appreciation of the object-oriented design
| > philosophy.
| | I would not really like to call Axiom (or Aldor) object-oriented.
| We don't write
| | a.add(b) | | in order to add two numbers.

There is more to object-orientation than "dot notation".  To my eyes
and mind, Aldor and Axiom are object-oriented, and they haven't yet
escaped that land :-(

Hmm, do you call the following object-oriented?

(That code appears in libalgebra distributed with Aldor and it basically provides a generic function that given a function "f: R -> S" returns a function "map(f)" of type "RX -> SX" that applies "f" on the coefficients of a univariate polynomial.)

    R : Join(ArithmeticType, ExpressionType),
    RX: UnivariateFreeRing R,
    S : Join(ArithmeticType, ExpressionType),
    SX: UnivariateFreeRing S
): with {
        map: (R -> S) -> RX -> SX;
} == add {
        map(f:R -> S)(p:RX):SX == {
                q:SX := 0;
                for term in p repeat {
                        (c, n) := term;
                        q := add!(q, f c, n);

What is the class and what are the methods?

Can you write that in JAVA or CLOS? I would be happy to see it.

| the function "add" is not attached to the object a. It is rather that
| a and b are on equal footing.

"equal footing" is not contradictory to object orientation.

Well, you may be right. But when I read about implementation of complex numbers in C++ and saw that a.add(b) construct, I really did not like it (at least not in the context of mathematics). It is saying: sent the message "add" with parameter "b" to the object "a". And it means that "a" has to do the work since "a" knows how to add something to itself. It is like saying. The integer 1 knows how another integer can be added to it. I don't consider that thinking to be quite natural in the context of mathematics. I agree, object-orientation be appropriate for other contexts.

| then it becomes clear that Axiom has more to offer that the
| current trend in programming.

The current trend in programming is some heavy or displcaed emphasis
on generic programming.

Sorry that I don't know CLOS, but I have looked a bit into JAVA's generics. And that is a lot weaker than what was already available in Aldor several years ago.

BTW, I don't say that Aldor hasn't some kind of object-orientation, but it is in my opinion not a pure object-oriented language.


reply via email to

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