{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/d1588981e0248aaa0174906c99df180e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"d1588981e0248aaa0174906c99df180e","url":"https://api.github.com/users/petdance","login":"petdance","id":41100},"assignee":null,"updated_at":"2011-11-01T05:38:47Z","labels":[{"name":"bug","color":"AF3AC4","url":"https://api.github.com/repos/petdance/scratch/labels/bug"},{"name":"core","color":"683FB1","url":"https://api.github.com/repos/petdance/scratch/labels/core"},{"name":"Pri-normal","color":"5B4E39","url":"https://api.github.com/repos/petdance/scratch/labels/Pri-normal"},{"name":"Sev-medium","color":"F9ECA1","url":"https://api.github.com/repos/petdance/scratch/labels/Sev-medium"}],"closed_at":null,"comments":0,"url":"https://api.github.com/repos/petdance/scratch/issues/1007","body":"When running the following code the the class associated to the [\"parrot\";\"Class\"] namespace gets overridden by the Foo9 class obj\nnewclass $P1, \"Foo9\"\r\n\r\ntypeof $P6, $P1\r\n\r\n$P3 = get_root_namespace [\"parrot\";\"Class\"] \r\n\r\n$P4 = get_class $P3\r\n\r\nprint $P4\r\n\r\nreturn \"Foo9\" instead of the expected \"Class\"\r\n\r\nthe function get_class in the default.pmc calls the pmc_new_init(interp, enum_class_PMCProxy, type_num); \r\nwhere the self object points to the Foo9 class obj.\r\n\r\nIn init_pmc in pmcproxy.pmc the interp->vtables[self->type_num = 102 in my case]->_namespace; points to the parrot;class namespace. Because this function effectually calls \r\nParrot_PCCINVOKE(interp, interp->vtables[self->type_num]->_namespace = parrot;Class, CONST_STRING(interp, \"set_class\"), \"P->\", SELF = class of Foo9);\r\nthe class associated to the parrot;Class namespace gets overridden.\r\n\r\nI solved this problem by adding following line to init_class_from_hash in the class.pmc\r\nnew_vtable->_namespace        = new_namespace; \r\n\r\nBut I don't know for what reason the interp->vtables[type_num]->_namespace is different from the interp->vtables[type_num]->pmc_class->_namespace\r\n\r\nSo I do not know whether this is the right solution to this problem.\r\n\r\nBut I added a special ticket for this because there is another bug.\r\n\r\n''Test''\r\n\r\nThe test in t/pmc/objects.t fails to detect this condition because of the bug described in ticket #879. \r\nBut adding a special test with the code described above would be good thing to do.\r\n\r\n\r\n\r\n\r\nOriginally http://trac.parrot.org/parrot/ticket/880","html_url":"https://github.com/petdance/scratch/issues/1007","title":"class associated to namespace [\"parrot\";\"Class\"] gets overridden","number":1007,"id":2106710,"created_at":"2011-11-01T05:38:47Z"},"action":"opened"}