axiom-developer
[Top][All Lists]

## Re: [Axiom-developer] about Expression Integer

 From: Gabriel Dos Reis Subject: Re: [Axiom-developer] about Expression Integer Date: 20 Feb 2006 22:02:01 +0100

```Ralf Hemmecke <address@hidden> writes:

| 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
| > | | 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?

Yes.

| (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.)
|
| UnivariateFreeRing2(
|      R : Join(ArithmeticType, ExpressionType),
|      RX: UnivariateFreeRing R,
|      S : Join(ArithmeticType, ExpressionType),
|      SX: UnivariateFreeRing S
| ): with {
|       map: (R -> S) -> RX -> SX;
|       map(f:R -> S)(p:RX):SX == {
|               q:SX := 0;
|               for term in p repeat {
|                       (c, n) := term;
|                       q := add!(q, f c, n);
|               }
|               q;
|       }
| }
|
| What is the class and what are the methods?

The class is the collection of "things" that you can "pretend" to be
univariate polynomials.
The methods are the necessary supporting functions you need to collect the
coefficients into something you "pretend" is a univariate polynomial.
For example here, add! is one of those 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).

The (standard) complex number implementations of C++ I know of do not
have "a.add(b)", and surely the implementations I'm familiar with do
not claim "object orientation", quite the contrary.

| 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

In the C++ implementations I'm familiar with, it is written "a + b".

| 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,

The reason why I mention CLOS is that it is close to Lisp (given the
general topic of this mailing list :-), it has an object system, and
given the _topic_,it has *multi-methods* (though I don't particularly
like their ambiguity resolution.)

| 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.

I believe you.  But again, I'm skeptical that we are going to make
Axiom lead if we insist on comparing with Java.  More advanced systems

| 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.

My view is that debates of "pure" <your-favorite-buzzword> are
meaningless as far as productive system building is concerned.
So, I will stop here.

-- Gaby

```