[Aldor-l] No Const Bug (was: Re: Const Bug?)
Christian Aistleitner
tmgisi at gmx.at
Sat Aug 19 02:02:59 EDT 2006
Hello,
On Sat, 19 Aug 2006 02:22:29 +0200, Ralf Hemmecke <ralf at hemmecke.de> wrote:
> Who can tell me whether the compiler behaves correctly when it rejects
> that program below...
I guess, this is actually correct behaviour ;)
Bear in mind, that { } does not necessarily create a new scope.
It does create new scopes for foo and bar, but not for fooConst and
barConst.
That is correct according to §8.1 AUG.
Hence the nth of fooConst is not local to fooConst, but local to the add
expression. Same holds for the nth in barConst.
So both constants nth are in the same scope. The nth of barConst is trying
to redefine the nth definide in fooConst.
> ---BEGIN aaaConst.as
> #include "aldor"
> #include "aldorio"
>
> AAA: with == add {
> foo(): Integer == {
> nth(): Integer == 0;
> stdout << "something" << newline;
> nth();
> }
> bar(): Integer == {
> nth(): Integer == 1;
> stdout << "else" << newline;
> nth();
> }
> fooConst: Integer == {
> nth(): Integer == 0;
> stdout << "something" << newline;
> nth();
> }
> barConst: Integer == {
> nth(): Integer == 1;
> stdout << "else" << newline;
> nth();
> }
> }
> ---END aaaConst.as
--
Kind regards,
Christian
More information about the Aldor-l
mailing list