[Aldor-l] with issue
Ralf Hemmecke
ralf at hemmecke.de
Sat Jul 5 11:36:48 EDT 2008
On 07/05/2008 05:23 PM, Peter Broadbery wrote:
> On Sat, Jul 5, 2008 at 10:58 AM, Ralf Hemmecke <ralf at hemmecke.de> wrote:
>> Hi Peter, hi Stephen
>>
>> I remember that long time ago I was told that an instance where
>>
>> A with B
>>
>> behaves different from
>>
>> with {A; B}
>>
>> is a bug.
>>
>> What would you say about the following?
>>
>> ---BEGIN aaa.as
>> #include "aldor"
>> A: with == add;
>> Cat: Category == with;
>> Cat2: Category == with;
>> extend IntegerSegment(Z: IntegerType) : with {
>> Cat with {Cat2; foo: A -> A};
>> } == add {foo(a: A): A == a;}
>> ---END aaa.as
>>
>> Compiling with
>>
>> aldor aaa.as
>>
>> results in
>>
>> "aaa.as", line 5: extend IntegerSegment(Z: IntegerType) : with {
>> .............................................^
>> [L5 C46] #1 (Error) Improper form appearing in `with' statement.
>>
>> Well, of course in that case it is easy to fix the sources, but the question
>> is whether the above program should be considered a well-formed Aldor
>> program. Is it?
>>
>> Ralf
> I don't think '(with C) with X' work gets through the parser either
> (not in a position to check it at the moment), so it's consistent.
> Given the parser refuses to look at the first one, making them both
> work might well be a problem.
Ooops, I would have thought, my code parses as
(*) with (Cat with {Cat2; foo: A -> A})
instead of
(+) (with Cat) with {Cat2; foo: A -> A}
as you see it. Why are the braces for, then?
Shouldn't they group together a sequence of statements and consider them
basically as one statement? So (*) should apply and not (+). Where is my
thinking error?
Ralf
More information about the Aldor-l
mailing list