Closed awilliamson closed 11 years ago
How is the above patch working for you ?
Yup seems to do it. I thought it would have just been a copy mistake somewhere, but it was very late my time. Thanks for the fix. Any news on the class extension fix?
Fine. I am closing this issue now. As for the class extension, I'll be working on it very soon.
I've found that if you set a default attrib as an empty table, eg children = {}. That upon editing that table, it will actually edit on the Class itself and never upon the instance like other attributes do. This has caused a few issues in my code and is very hard to track down.
I can't give you example code, but try making 2 instances of a Class which use the Class getter for a attribute which is defaulted to an empty table. If you let the class system assume the default and do no assignment in the init, it leads to unexpected behaviour.EDIT: I decided to run a test case to show how the table reference is the exact same.
If you run that example code it should show the table references to be the same:
The style of code in the example is of rough design to that of my project, however I am doing this with an extended class, but this is clearly a system-wide issue.
I hope this is a bug that is not too difficult for you to fix, my temporary solution is to remove the usual default attrib definition from the class def and just plain self. attrib = {} inside the unit.
Use the snippet below to modify the original test case, and it should work.
As you can see by the image below, this appears to fix the issue.