[Gambas-user] Fixing bug tracker issue 78
Benoît Minisini
gambas at ...1...
Wed Aug 31 16:34:59 CEST 2011
> On Wed, 2011-08-31 at 03:13 +0200, Benoît Minisini wrote:
> > > Sorry, I'm really panicky, I meant method overriding not polymorphism.
> > > Bruce
> >
> > This change only makes the interpreter raise an error instead of
> > eventually segfaulting, by preventing something that is forbidden :
> > changing the signature of a method through inheritance.
> >
> > That has nothing to do with virtual dispatching : the overridden method
> > is always called.
>
> Oh no! I have dozens of gambas2 libraries that take advantage of this.
> See attached project for a "model" of lots of what I have done. I don't
> understand why it should be "forbidden"? Why would the interpreter
> segfault?
> Bruce
This is one the design rule of Gambas : a method has to always return the same
datatype, otherwise it must return a Variant.
That way, the interpreter can optimize its code at runtime.
In your example, through inheritance, the same method may return a Variant[]
or a String[] for example.
If you have a real example, I may tell you how to do differently.
Regards,
--
Benoît Minisini
More information about the User
mailing list