Skip to content


Can modify inheritance after instantiation #1021

Util opened this Issue · 0 comments

1 participant

Parrot Virtual Machine member

Reported by:

Instantiating a class directly sets its "instantiated" flag, which prevents further changes to its parentage, but indirectly instantiating it doesn't set the flag. The result is that the class hierarchy behind an existing object can be modified:

$ cat t56.pir
.sub main :main
        $P0 = newclass "Foo"
        $P1 = newclass "Bar"
        $P2 = subclass "Bar", "Baz"
        $P3 = new "Baz"
        $I0 = isa $P3, "Foo"
        say $I0
        $I1 = isa $P3, "Foo"
        say $I1
$ ./parrot t56.pir

Note that caching of inheritance relationships means that the second isa check gives the wrong answer.


Summary of my parrot 5.7.0 configuration:
  configdate='Sat Oct  5 12:42:43 2013 GMT'
    osname=linux, archname=x86_64-linux-gnu-thread-multi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.