[Gambas-user] How do I override an Array class?
tobi
tobiasboege01 at ...1601...
Sun Jun 17 15:40:44 CEST 2012
On Sun, 17 Jun 2012, Benoît Minisini wrote:
> Le 17/06/2012 08:22, Bruce a écrit :
> > I would like to override the Variant[] class to extend it with a small
> > set of special interest methods.
> >
> > The gambas IDE complains when I try to call my class "Variant[]".
> >
> > I cannot find anything in the help that seems to preclude this, apart
> > from the class naming rules.
> >
> > Is this possible?
> >
> >
> > (More detail: I am trying to restructure a large parsing project that
> > works with hundreds of arrays of tokens, there is a huge amount of
> > redundant code in it that repeats the same operations on the array.
> > What I first tried doing was creating a class that inherits Variant[]
> > and adds a few of the required methods, called "MyVariant". Then going
> > through the parser project and replacing each As Variant[] with As
> > MyVariant. This has raised a problem (of my own making!) where the
> > classes in the parser inherit others in the project, I need to change
> > the declarations in each inheritance chain in a single step. This makes
> > it fairly difficult to isolate each use of the redundant code and change
> > it to use the standardised code in MyVariant.
> > So, I figured that if I could just override the Variant[] class then I
> > could work on one of the parser classes at a time, clean it up and move
> > on and not be bugged by the continual compile/fix/compile/fix cycles I
> > am causing while not even getting far with the real goal.)
> >
> > Bruce
> >
>
> You can't override Variant[] because '[' and ']' are not allowed in
> project file names.
>
> You can do that by creating the source file by hand, but you may have
> problems - This is the reason why it is forbidden. :-)
>
> I don't see what the real problem is with replacing all occurences of
> Variant[] by something like "MyTokenArray".
>
> --
> Benoît Minisini
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
Wow, didn't know that. Is there any piece of documentation to quote when telling this someone?
Regards,
Tobi
More information about the User
mailing list