Skip to content

Loading…

Can modify inheritance after instantiation #1021

Open
Util opened this Issue · 0 comments

1 participant

@Util
Parrot Virtual Machine member

Reported by: zefram@fysh.org

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
        $P1."add_parent"($P0)
        $I1 = isa $P3, "Foo"
        say $I1
.end
$ ./parrot t56.pir
0
0

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

-zefram

Summary of my parrot 5.7.0 configuration:
  configdate='Sat Oct  5 12:42:43 2013 GMT'
  Platform:
    osname=linux, archname=x86_64-linux-gnu-thread-multi
    perl=/usr/bin/perl
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.