[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] Re: Literate programming and Provisos
From: |
Ralf Hemmecke |
Subject: |
[Axiom-developer] Re: Literate programming and Provisos |
Date: |
Mon, 09 Jul 2007 00:53:52 +0200 |
User-agent: |
Thunderbird 2.0.0.4 (X11/20070604) |
One can think of a continuation is an abstract object representing the
remainder of a computation. We normally think about functions
returning values, with continuations we pass the value to the
remainder of the computation.
Oh, are you trying to say that in order to pass some value to the
continuation, I don't need to know what the ongoing computation actually
does? How do you think that fits in a typed environment like Spad/Aldor?
It is common to have a continuation
represented explicitly as an argument. In Spad or Aldor, this might
be written as:
add-cc (c : Continuation(Integer), n : Integer) : Integer ==
c(n + 1)
The first think that came to my mind when I saw that was to represent
Continuation(Integer)
by something like
Integer -> Generator(SomeType)
where SomeType for your example above would be Integer, but as you said,
a continuation is not a function so its return type is rather unclear.
So how could (for your code) the compiler check that c(n+1) is indeed of
type Integer (as add-cc claims). Continuation(Integer) says something
about the input argument, but not about some return type.
Anyway, even if I could model some continuation by
INTYPE -> Generator(OUTTYPE)
there is an issue with destructiveness. Aldor/Spad is not a functional
language. So if c is a continuation and I call
foo(c); bar(c);
then usually bar doesn't get the some "continuation" as foo gets, since
foo might change that computation destructively (as is usually the case
for Generator in Aldor).
Ralf