axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] Re: [Aldor-l] exports and constants


From: Antoine Hersen
Subject: [Axiom-developer] Re: [Aldor-l] exports and constants
Date: Mon, 24 Jul 2006 22:35:31 +0200

On Aldor type system discussion :

No all parameter of a type are equivalent( see program at the end) :

MyVecCat( 10) == MyVecCat( 20)
but
MyListCat( Int ) != MyListCat( String)

Even if the argument is not use in the category definition.

Also "type as value" is something unusual for me, try this :

---------------------------------
#include "aldor"
#include "aldorio"

import from  Boolean , MachineInteger;

define MyListCat( t:PrimitiveType ): Category
== with {
    size: () -> Integer; }

MyList(t: PrimitiveType): MyListCat( t )
== add { size(): Integer == 1 }

Mytype:PrimitiveType == String ;
Mytype2: PrimitiveType ==  Integer ;

MyRandomType: PrimitiveType ==
if odd? random(2) then Mytype else Mytype2 ;

stdout << (MyList( MyRandomType)   has MyListCat( String)) << newline ;
-----------------------

So type are static but not determined at compile time.
 
It is why you are allow to use only '==' and no ':=' but if you use destructive function on one of your type argument you have found a sure way to crash any program.

Also I do not know much about dependent type, but I think it is a run time feature only contrary to polymorphic type.

So how much optimization can we hope to do ? For example can I do unboxing for my polynomial if I am not sure that they will be over machine integer at compile time ? Do we have to use dynamic language trick ?

Also about the user guide. It is what the title say a user guide not a language reference manual.
I am personally quite confuse with the Type description.

I think it is important to have a more formal Aldor semantic.

The type system is quite unique and has some resemblance to modern typed language, for example aldor "Category", from far, look like Haskell "class type".
But from my limited knowledge, type as first class value and dependent type his quite unique.

There is a paper about the aldor type system on aldor.com I have not taken the time to read it completely but it could be a start even if it only represent a subset of Aldor.

Chapter 18: Recomendation is very interesting.

I will support the adition of algebraic datatype and I think any addition or modification that make Aldor closer to the popular modern functionall languages will be welcome.

Also some question that come in my mind :

Do we need a "type system" for the type definition( think Haskell "kind") ?

What about "pretend" is it really needed ? and the special place of Rep, rep and per ?

Is it possible to implement type inferrence ?

Are any modification needed to make it even more suited for programming computer algebra ?

This only my personal, not very well informed, impression but the Aldor type system seem to have been created out of practical need, I will say trying to formalize a bit the SPAD one but still lack solid theorethical fundation.
( My bias as an ML enthousiast is that sound theoretical fundation is a must have )

I know there is a lot of hope that the Aldor compiler will become open source.
But a very large piece of un documented C code will not be very ususefull if nobody with a good knowledge of it is willing and able to spend a lot of time on cleaning( I think it does not compile under recent version of gcc), writing documentation and debugging( optimization above O1 does not seem to preserve semantic).

Maybe we should "audit" aldor source code and decide if we should write a new implementation ?

Something not to forget is the tools around a language, we need a good debugger, profiler and co.

For example Ralf Allprose and Christiant Unit testing should be part of the upcoming open Aldor realase and their usage covered in the user documentation to be sure every one use them as much a possible.

Regards
Antoine Hersen

-- No all type are equal
#include "aldor"
#include "aldorio"

import from  Boolean , Integer;

define MyVecCat( i:Integer ): Category
== with {
    size: () -> Integer; }

MyVector(i:Integer): MyVecCat( i )
== add {
    size(): Integer == i
}

stdout << (MyVector( 1)  has MyVecCat( 1)) << newline ;
stdout << (MyVector( 1)  has MyVecCat( 2)) << newline ;

define MyListCat( t:PrimitiveType ): Category
== with {
    size: () -> Integer; }

MyList(t: PrimitiveType): MyListCat( t )
== add {
    size(): Integer == 1
}

stdout << (MyList( String)   has MyListCat( String)) << newline ;
stdout << (MyList( Integer)  has MyListCat( String)) << newline ;

reply via email to

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