[Aldor-l] parametric types and instantiation (was: Re: Should this "parser" work?)
Christian Aistleitner
tmgisi at gmx.at
Wed Oct 25 05:20:05 EDT 2006
On Tue, 24 Oct 2006 08:55:31 +0200, Gabriel Dos Reis
<gdr at integrable-solutions.net> wrote:
> "Christian Aistleitner" <tmgisi at gmx.at> writes:
>
> | Hello,
> |
> | On Mon, 23 Oct 2006 09:39:00 +0200, Martin Rubey
> | <martin.rubey at univie.ac.at> wrote:
> |
> | >> First of all, what do you mean by “instance of Atom”. Atom is a
> | >> domain. For
> | >> the domain MachineInteger, 34 is an instance, just as 35 or 36 are.
> | >> But for
> | >> Atom?
> | >
> | > I'd think that domains are instantiated, since it may happen that
> they
> | > contain some local data. But that's a very vague idea.
> |
> | still I do not understand, what you mean by “instantiated”.
> | My interpetation of “instantiate” merely coincides with that of
> |
> http://en.wikipedia.org/wiki/Object_(computer_science)#Objects_in_object-oriented_programming
> |
> | I know that Aldor is not an OO language. But the differences are not
> | important for the meaning of “insntantiate”.
>
> My understanding of it, from working on programming language that
> supports both OO and parameterized type is that when you have a
> parameterized domain definition c
>
>
> Domain(t : Type) == ...
>
> calling Domain with argument, say, Integer, is an instantiation of the
> Domain with type Integer.
Bear in mind, that Martin's Atom is _not_ a function. Atom is a plain,
constant domain. So your example actually does not really apply.
There is just one Atom. Not an Atom(0) and Atom(1).
Furthermore, I guess you are mixing up concepts of parametrized types and
Aldor, at least conceptionally.
In Aldor, there are no parametrized types or domains.
Dom( Param ): ReturnType == add { ... }
is effectively _not_ a parametrized domain Dom, but Dom is a constant. Dom
is a function (just like any other function, like
add:( Integer, Integer ) -> Integer
). However, the function Dom creates domains.
In OO, you instantiate Dom.
In Aldor, you evaluate Dom.
In OO, instantiation of Dom always carries a (at least conceptional)
connection to Dom.
In Aldor the result of Dom( A ) is (hopefully) completely decoupled from
Dom and A, just as the result 7 of add( 3, 4 ) is completely decoupled
from add, 3, and 4.
--
Kind regards,
Christian
More information about the Aldor-l
mailing list