[Top][All Lists]

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

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

From: Bill Page
Subject: RE: [Axiom-developer] Cast = pretend in Spad/Aldor? (was: B#)
Date: Tue, 22 Nov 2005 23:10:05 -0500

On November 22, 2005 3:38 PM Peter Broadbery wrote:

> Bill Page wrote:
> > 
> > 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:
> > 
> >
> > 
> > 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.

I would be interested to learn of any examples where this sort
of use of 'pretend' was essential, i.e. where it can not be
replaced with some operations defined on the underlying domains.

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

My reaction on first meeting rep and per in Aldor was the same.
It seemed strange to me that these where not primitives. Peter,
do you know of anything written about Rep, rep and per that
discusses these issues? The only mention I have found so far is
in the Aldor documentation itself.

>From the definition of rep and per as macros:

  macro {
        rep x == x @ % pretend Rep;
        per r == r @ Rep pretend %;

it is seems clear that this use of 'pretend' is always type-safe
since objects of type % are necessarily constructed from something
of type Rep, so the only thing that 'pretend %' does is to "hide"
the internal structure of the Rep object, where as 'pretend Rep'
merely recovers it.

So it seems likely that if we could drop pretend from Aldor and
make rep and per primitives, then Aldor could then be truly
said to be strongly typed (i.e. type-safe in terms of it's own
semantics). Does this make sense?

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

By "is a member of %" do you really mean "is a representation
of an object of type %"? I am not sure how one could use 'per?'
since the representation is supposed to be purely internal to
the domain, right?. That some Rep is a representation of some
% presumably depends on the internal logic of the domain. So
would 'per?' act as some kind of assertion to be checked at
run time?

I am fascinated by this construct but I do not feel that I
understand it very well yet in spite of seeing how it is used.
If anyone has recommendations for further research along this
line, I am "all ears".

Bill Page.

reply via email to

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