[Gambas-user] Inheritance and Signature checking in gambas 3
Benoît Minisini
gambas at ...1...
Tue Sep 20 21:18:30 CEST 2011
>
> Thanks, for looking at this (again) Benoît. I will build a simplified
> set of the structures and post it (it is just too big at 18 or so
> components to post as one chunk) over the next few days. I'll also have
> a look at your note 4 and see if that provides a way around the
> problem.
>
> But regarding note 1) "Not ensuring that the signatures of a child
> method is exactly the same as the parent method was a Gambas 2 bug that
> can lead to interpreter crashes." This is the bit I don't understand.
> In the hundreds if not thousands of lines of code in my gambas2
> projects, I have never seen it crash in this way. As I said these
> projects have been running for several years.
Because you were lucky. :-) The way you used method overriding didn't lead to
crashes.
>
> And as to note 2) "The contrary is, for me, completely illogical." I
> must disagree, method overriding is a well known object oriented design
> aspect. (And I know you know :-)
Yes, but if the child method does not have the same signature than the parent
method, you "break the contract". If B inherits A, that means that all B are
A, and so B.Method(x, y, z) must be replaceable by A.Method(x, y, z)
everywhere.
> as you have said yourself in a comment
> in issue 78 "And the check is not done too for a native class inheriting
> another native class. C/C++ programmer are supposed to know what they
> are doing. :-)" ).
The check should be done, but it will make the interpreter slower. So I
decided not to do it, and let C/C++ programmer be careful.
Regards,
--
Benoît Minisini
More information about the User
mailing list