Fabian and Jussi, Thanks guys, this is now so close it hurts!
On Fri, 2011-12-09 at 20:04 +0200, Jussi Lahtinen wrote: > Perhaps you need something like this: > > Public Function F1(...) As Integer > > Return F2(Param.All) > > End > That (Param.All) appears to be the big part of the solution. However, it has a little problem in my particular situation that's way down the bottom of this post. On Fri, 2011-12-09 at 20:04 +0200, Jussi Lahtinen wrote: > But even better if you can change the structure of your program so that you > don't have to re-pass all the parameters. > BTW. Do you know command TypeOf() ? It may be useful with this case. On Fri, 2011-12-09 at 13:30 +0100, Fabien Bodard wrote: > to use "..." it's really rare it's for polymorphe call via a hard > coded function : > > F2(toto, tata, titi) > F2(toto,tata) > > but it not seem to be your case Here's the real situation, which explains what I'm trying to do. I have 5 production systems in gambas 2 that are represented by over 80 gambas projects. They each use one of three gb2 components to do database access. These 3 libraries are very similar functionally, they implement the Create, Read, Update and Delete actions on the database and some other utility functions (like checking if a row exists for a primary key value). In moving these to gambas3, I am trying to merge the three gb2 components into a single gb3 library. This has been 99% successful, everything but the Read functions have been rationalised, merged and now all these functions work using common function calls. Read is the problem, one gb2 component's Read function uses an array of primary key values, one uses a "pseudo query" string and one uses a class that represents a "query by example" structure. There are hundreds, possibly thousands, of calls to the Read function spread throughout all these gb2 projects. The signatures look like this: Public Function DBRead(oTarget as Object, vPKey as Variant[]) as Boolean Public Function DBRead(oTarget as Object,sQuery as String, Optional sSort as String) as Boolean Public Function DBRead(oQBE as QBE) as Boolean where oTarget is the object that the data will be loaded into. The functionality of the three Reads is the same - the rows read from the database end up in the target object. The only differences are the calling signature and how the target is specified (in the QBE example it is inside the oQBE class). So, here's my desire: Rather then go through all the projects and "fix" all of the calls to a common signature, I thought I could make a "wrapper" function in the new library: Public Function DBRead(...) as Boolean that would look at the Params and call an appropriate internal function to handle each type. I think that would be a lot quicker. As usual, I have complicated the problem by putting the wrapper function in a class that inherits the base DBAccess class. The reason being that at some time in the future, the calls will all be rationalised to a single signature. For instance, I'll possibly retire the QBE method as it is overly complex. The pseudo code for the public DBRead now looks like this: Public Function DBRead(...) as Boolean Dim localtarget as Object Dim localquery as String Dim localsort as String If Param.Count = 1 and Param[0] is QBE then decipher_QBE(Param[0],localtarget,localquery,localsort) Return Super.DBRead(localobject,localquery,localsort) else Return Super.DBRead(Param.All) Endif The base class DBRead(...) theortically can decipher which call type it's got OK. BUT~! I can't debug it??? When I try and display the Param class in the debugger or include things like Debug Param[0] it shows an "Out Of Bounds" error. Is this something I've done or a gb3 issue? regards Bruce ------------------------------------------------------------------------------ Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user