What does this do?

Das Goravani goravanis at gmail.com
Fri Jun 25 18:42:28 UTC 2021


In Grahams example on translation through Google API
He has this code that makes no sense to me
I get the code normally, but not in this usage

He has the following call to a method in one place

Do iorefRest.$returnVal(irResponseHeaders,irResponse,irJSON) Returns icJSON

And I checked, the first two variables in parameters contain values as a row, but irJSON is NULL

That is true after it’s called, that the first two contain values and last one is NULL

The code in $returnVal has me confused, it is this:


Calculate pResponseHeaders as irResponseHeaders
Calculate pResponse as irResponse
Calculate pJSON as irJSON
Quit method icReturn


Note that the fields beginning with p are parameters indeed and they are field references, the call passes in field names

The 3 fields beginning with ir exist as instance variables on both the calling method and within the oREST object that gets called 

I don’t understand why one would pass as parameters 3 field names and then repack the parameters with those same field names then quit 

Interestingly, after this is called, icReturn includes an error message saying Invalid character in JSON text”

I don’t see where these fields are being packed.. does calling this REST object do some magic I’m not seeing?

OK, I’m thinking it through and is this right?:  The field names passed are where they want the values to end up, this method takes values from 3 instance variables INSIDE the oRest object and puts them into the same named fields that exist as instance variables back on the calling window..

That makes sense to me.. allows you to have persistent field names across unrelated classes as instance variables

AM I now seeing it right perhaps?

If this is true then this oRest object was called earlier and contains values to pass back?


More information about the omnisdev-en mailing list