axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] Unions in Spad


From: Stephen Wilson
Subject: Re: [Axiom-developer] Unions in Spad
Date: 13 Jul 2007 19:57:30 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Hi Ralf,

Regarding `rep' and `per'.

I see the issue as follows.  Ideally, a definition of type Rep in
domain context should automatically generate two functions `rep' and
`per' (I like `inj' and `prj', for inject and project, myself) with
the familiar signatures.  The compiler has special knowledge about
these functions and knows they can be applied to convert between Rep
and %.  As Gaby pointed out, these can be defaults with the
possibility to override.

Spad effectively does this, so that if you have a context like `... =
[n]', then an implicit function analogous to `per' can be selected as
a form of auto-coercion to satisfy the type.

I agree that in Spad the implicit functions should be named and
available.

Note that both Aldor and Spad try hard to infer types.  The draw back
in Aldor is that rep and per are macros, and thus do not carry any
useful semantic information and cannot be used by the compiler to
perform the conversion.


Take care,
Steve








reply via email to

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