OOABL: How to access native function in method with same nam

Posted by cverbiest on 20-Nov-2013 09:29

In OOABL it is possible to create a method with the same name as an internal ABL function.

Is there a way to access the native function in a class that does this ?

e.g

    method public character Substitute(input iString as character):
        /* call original internal function */
        return substitute(iString,
                this-object:String1,
                this-object:String2,
                this-object:String3,
                this-object:String4,
                this-object:String5,
                this-object:String6,
                this-object:String7,
                this-object:String8,
                this-object:String9).

    end method.

results in Mismatched number of parameters supplied to 'Substitute'. Expecting 1 but 10 were specified. (2680) -

which indicates that substitute is interpreted as this-object:substitute and not the native substitute function.

All Replies

Posted by Thomas Mercer-Hursh on 20-Nov-2013 09:49

Why would you name your function to match a keyword?   That seems like asking for trouble.

Posted by Peter Judge on 20-Nov-2013 09:54

Alas no. Not nicely anyhow: there's no way of saying "I want to use the ABL function" (an enhancement request would be good to allow this).

You can cheat - or maybe more accurately "take advantage of the abl" - and say something like the below. It uses the trnuncated/shortened version of the ABL keyword. It's not the 100% correct solution and may not work in all cases but it may get you to where you need to be.

method public character Substitute(input iString as character):
       /* call original internal function */
/*[PJ] note that we are using the shortened ABL keyword here */
      return substi(iString,
               this-object:String1,
               this-object:String2,
               this-object:String3,
               this-object:String4,
               this-object:String5,
               this-object:String6,
               this-object:String7,
               this-object:String8,
               this-object:String9).
   end method.

-- peter

Posted by cverbiest on 20-Nov-2013 10:20

Maybe it's not a good idea to use an existing function as a method name, but Progress seems to allow it.

Such a situation can also arise if Progress adds new functions in the future.

Posted by Peter Judge on 20-Nov-2013 10:24

This is really useful for the cases where the ABL developer wants to provide object representations of build-in stuff: a String.cls for example might have a Trim() and Substitute() method which shadows/wraps the built-in functions.

It's already possible to disambiguate going the other way  and compel the ABL to call the method via an object reference like THIS-OBJECT, but not to be able to compel the AVM to func the built-inf function.

-- peter

Posted by Lieven De Foor on 26-Nov-2013 15:38

I have the same problem with "ENCRYPT" and "DECRYPT", only in those cases there is no shortened version of the keyword...

So if I really want to use the same name (I hate things like Encrpt/Decrpt or worse), I think the only option would be to call a .p which 'encapsulates' the call to the ABL function with the same name?

This thread is closed