axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] Cast = pretend in Spad/Aldor? (was: B#)


From: Peter Broadbery
Subject: Re: [Axiom-developer] Cast = pretend in Spad/Aldor? (was: B#)
Date: Tue, 22 Nov 2005 20:38:26 +0000

On Mon, 2005-11-21 at 14:27 -0500, Bill Page wrote:
> On November 21, 2005 12:59 PM Gaby wrote:
> 
> > 
> > "Bill Page" writes:
> > 
> > | On November 20, 2005 11:50 PM Gaby wrote:
> > | > | 
> > | > | We have mentioned before on this list the very good article
> > | > | 
> > | > | http://en.wikipedia.org/wiki/Datatype
> > | > | 
> > | > 
> > | > That is interesting but the link above is confused to start
> > | > with. I quote: 
> > | > 
> > | >    An example of the absence of strong typing is a C cast 
> > | >    gone wrong; if you cast a value in C, not only is the
> > | >    compiler required to allow the code, but the runtime is
> > | >    expected to allow it as well.
> > | > 
> > ...
> 
> Actually, perhaps I should simply concede that the above
> article is not particularly good, and I will be glad to do
> so if you can recommend a better alternative that defines
> these terms more accurately.
> 
> But really I don't want to be spending a lot of time arguing
> about the merits of the C programming language on this list.
> What I would really like to think about is strong static typing
> in the context of Axiom, specifically in Spad and in Aldor.
> 
> There is one very important type-related construction in
> Spad and in Aldor that looks as if it might make them "weak"
> in the sense in which the author of the above quote implies
> the use of cast in the C language makes it weak. That is the
> use of 'pretend'.
> 
> It is pretty clear in the following example that the Axiom
> interpreter does something odd:
> 
> (1) -> I:Integer
>                                                 Type: Void
> (2) -> F:Float:=1.0
> 
>    (2)  1.0
>                                                 Type: Float
> (3) -> I := F pretend Integer
> 
>    (3)  1()
>                                                 Type: Integer
> 
> ------
> 
> Yet the ability to use 'pretend' is critical to the concept
> of representation in the construction of Axiom domains.
> 
> For a perhaps overly abstract discussion of this see:
> 
> http://wiki.axiom-developer.org/RepAndPer
> 
> So my question is: Does this feature of the Spad and Aldor
> languages actually make them "weakly typed"?
> 

I'd say it does, at least for some definitions of the term.  I'd very
quickly follow up by saying 'but who cares', since it's obvious that
they occasionally have their uses (as Tim suggests, system level code,
and where you just know that your domain is implemented in a particular
way).  I've rarely seen a need for the second use, but one persons app
level could be system level to someone else, I guess.

For Rep, rep and per, I (personally) believe they should have been
language primitives, except that add-inheritance confuses the issue a
little. They should definitely be thought of as primitive.

There is an idea of adding a third operation 'per?', defined by the
programmer which tests if an object of type Rep is really a member of %,
and would be called immediately before each 'per' operation.  I'd hate
to be forced to write it each time though.

Peter


> 
> 
> _______________________________________________
> Axiom-developer mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/axiom-developer




reply via email to

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