Re: Equivalent of classes in LiveCode
Posted: Tue Aug 18, 2020 5:17 am
Brian-
I'm sure you're right about the superClass command. That's a relic of some earlier experimenting and I'm not using it anywhere.
Much the same for the setClassForControl command. It was in Hakan's original code, so I didn't feel I should delete the command, although I don't think it properly belongs in an OOP context.
You're partially right about the destructor code. The destructor is properly being called, but the "die" command is failing because in one case the object has already been deleted by the animate code in the Emittor button, and in the other it's not kosher to have an object delete itself while its code is still executing.
The instance variables of the various classes are not tied to the abstract class but to what I think of as local shadow backscripts of the instantiated objects. Otherwise the dx/dy variables for the individual particles would all be the same.
And moving away from groups was because the original intention of the groups was to create copies of the abstract classes on the Classes card, which is no longer necessary, as you noted, with behaviors. Creating a button in the newObject code just fell out from that exercise, and there's no reason why it needs to be limited to a button. The newObject command could easily take a control type as an argument, and probably should.
But I hope you're not thinking of "multiple inheritance" in a way that is different from serial inheritance. That way lies madness.
...and I would *love* to have dot notation to work with here, but there's absolutely no chance of getting that integrated into the language.
I'm sure you're right about the superClass command. That's a relic of some earlier experimenting and I'm not using it anywhere.
Much the same for the setClassForControl command. It was in Hakan's original code, so I didn't feel I should delete the command, although I don't think it properly belongs in an OOP context.
You're partially right about the destructor code. The destructor is properly being called, but the "die" command is failing because in one case the object has already been deleted by the animate code in the Emittor button, and in the other it's not kosher to have an object delete itself while its code is still executing.
The instance variables of the various classes are not tied to the abstract class but to what I think of as local shadow backscripts of the instantiated objects. Otherwise the dx/dy variables for the individual particles would all be the same.
And moving away from groups was because the original intention of the groups was to create copies of the abstract classes on the Classes card, which is no longer necessary, as you noted, with behaviors. Creating a button in the newObject code just fell out from that exercise, and there's no reason why it needs to be limited to a button. The newObject command could easily take a control type as an argument, and probably should.
But I hope you're not thinking of "multiple inheritance" in a way that is different from serial inheritance. That way lies madness.
...and I would *love* to have dot notation to work with here, but there's absolutely no chance of getting that integrated into the language.