[Aldor-l] [open-axiom-devel] generators
Ralf Hemmecke
ralf at hemmecke.de
Wed Oct 24 17:55:28 EDT 2007
> Just curious: can something of type Generator(Something) ever be a domain?
> (Probably yes...)
>aldor -fx -laldor aaa.as
>aaa
MachineInteger
123
---BEGIN aaa.as
#include "aldor"
#include "aldorio"
CAT ==> OutputType with {integer: Literal -> %}
g(): Generator(CAT) == generate {
yield MachineInteger;
-- yield Integer;
}
foo(D: CAT): () == {
import from D, TextWriter, String, Character;
stdout << name(D)$Trace << newline;
stdout << (123 at D) << newline;
}
for D in g() repeat foo(D);
---END aaa.as
But don't remove the -- before "yield Integer", because then the
compiler tells you... :-(
"aaa.as", line 5: g(): Generator(CAT) == generate {
................................^
[L5 C33] #1 (Fatal Error) Compiler bug: no exit list for terrorSequence
(ooops).
Since in Aldor domains are first class, it should be possible to return
them by a generator. (Compare to lists of domains.)
However, your question asks whether g is a domain if
g: Generator(Something)
and I would tend to say that this is not a domain. Why? Well,
"Generator(Something)" should be a category then, right? But if you look
int sal_gener.as you clearly see that Generator(T) is a domain.
Ralf
More information about the Aldor-l
mailing list