> class B
>   extends A;
>   Real y; // double definition?
>   B.B b; // This would not be needed for stack overflow
> end B;

So you believe that the following class should actually work? (It won't, for sure)
class A
  A a;
end A;

And regarding

package Test
  class A
    extends B;
    Real x;
    class B
      extends A;
      Real y; // double definition?
    end B;
  end A;
end Test;

class A
  Test.A a;
  Test.A.B b;
end A;

What do you think the output should be? We could possibly guard against extending the same class with the same modification more than once. (extends A(x=5); extends A(x=6); should produce double definitions. extends A(x=5); extends A(x=5); should not).

--
Martin Sjölund

On 2010-11-17 08:43, Christoph Höger wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

the following example produces a stack overflow in omc 1.5.0.svn.r5700-1.deb

package Test
     class A
         extends B;
         Real x;
         class B
             extends A;
             Real y; // double definition?
             B.B b; // This would not be needed for stack overflow, but
should be correct too
         end B;
     end A;
end Test;

I am not quite sure, why the extension from inner classes is even
allowed (maybe for some fancy type constructs), but the specification is
quite clear on that point. This is a little bit complicated, but from my
POV it should work that way:

- - when B is looked up from "extends B" in A, the "partially flattened"
environment of A is used in B which yields scope(B) = { 'B' = Test.A.B,
'x' = Real, y = 'Real', b = 'Test.A.B' }

- - when B is looked up itself, the above scope is handed down, which
_might_ result in a "double definition" error for y but at least should
succeed in type creation.

Basically the problem arises with circular inheritance, which would in
general require a fixed point analysis. But since the specification
simply states that the type names in extends clauses are looked up
ignoring all other extends clauses, it should work.

best regards,

Christoph

- --

Christoph Höger

Technische Universität Berlin
Fakultät IV - Elektrotechnik und Informatik
Übersetzerbau und Programmiersprachen

Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin

Tel.: +49 (30) 314-24890
E-Mail: [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkzjh5UACgkQhMBO4cVSGS+/PgCfXxfL5Im0XUHa83vdhPSmhsm7
r7MAn2l00xtlIODbot76hCs9/va7vmH9
=jNtX
-----END PGP SIGNATURE-----

Reply via email to