[Gambas-user] Advising methods of non-fixed argument tuple in a parent class
Bruno Félix Rezende Ribeiro
oitofelix at ...181...
Tue Apr 22 17:28:41 CEST 2014
Em Tue, 22 Apr 2014 11:50:45 +0200
Benoît Minisini <gambas at ...1...> escreveu:
> I have just came back from "holidays", and I haven't read all the
> pending mails yet.
>
> I just want to say that if you have problem with Gambas inheritance
> and "SUPER" limitations, you can replace inheritance by "composition".
>
> I mean : instead of inheriting "Variant[]" or reimplementing it, you
> can create your own "MyVariantArray" class that embeds a Variant
> array as a private dynamic variable. Then you will be able to do
> almost everything you need.
Indeed, "composition" is the best option given the current situation.
Wise advice. Correct if I'm wrong, but I think that is best exploited
when using '_unknown' and '_property' special methods to
transparently deliver any method or property request directly to the
private dynamic array. This way one don't have to wrap every possible
array method or property and the class can be made agnostic of array
type.
> Another point: It's not a good idea to reimplement native array
> classes. These classes must be as fast as possible, they are used
> everywhere. I don't think that you need an "Update" event for every
> array in your application, do you?
No, I don't. It's a very specific use case.
Thank you.
Happy Hacking!
--
,= ,-_-. =. Bruno Félix Rezende Ribeiro (oitofelix) [0x28D618AF]
((_/)o o(\_)) There is no system but GNU;
`-'(. .)`-' GNU Linux-Libre is one of its official kernels;
\_/ All software must be free as in freedom;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20140422/4f331989/attachment.sig>
More information about the User
mailing list