Alternative to using % to make a variable public

I am reviewing some code where the % sign has been used liberally to name arrays that are worked on by different methods within the same class. Apparently it is not good practice to name variables with a "%" sign as the first character because this could overwrite other similarly named variables from other developers, including ISC!  Is there another way to make a variable public ? 

  • 0
  • 0
  • 340
  • 5
  • 3


To specify the list of public variables for the method, use the following syntax:

Method name(formal_spec) As returnclass [ PublicList = variablelist ]

Where publiclist is either a single variable name or a comma-separated list of variable names, enclosed in parentheses.

In the documentation search for publiclist and you can get the details

for that case passing the variables by reference should be sufficient. 

ClassMethod Main() 
    Do ..InvokedMethod(,var1,.var2)
    W !,var1
ClassMethod InvokedMethod(byRef var1, byRef var2) 
    Set var1 = "ChangedInInvoked"

Small addition: objects are always passed by reference, so usually you don't need to pass them with dot.

In a true OO-fashion, you should use private properties for that. Available anywhere within your (instantiated) class, but not for the 'outside' world.


You could also use process-private globals

Variables should never be global in scope.

As others have said they should be part of class instances or passed by reference.

PPGs are intended more for very local, non persistent, storage - e.g. private data within a spawned job.

The question was about alternatives to using % which is what I answered.