Chapter Contents

Previous

Next
SAS Component Language: Reference

Passing Lists as Arguments for Methods

Lists that are not declared as LIST type are treated by the compiler as numeric types in order to maintain compatibility with Version 6. However, the more accurate specification of LIST should be used in Version 7 programs, particularly those that use lists in conjunction with method overloading. For example, suppose you use the list MYLIST as an argument for a method that has one version that takes a numeric argument and another that takes a list argument. If MYLIST is not declared as LIST type, then it is treated as a numeric type and the wrong method is called: the one that takes the numeric argument, instead of the one that takes the list argument.

When a list with type LIST is passed as an argument to a method, SCL seeks a method that accepts a LIST argument. If no exact type match is found, the list is passed to a method that accepts an numeric argument. For example, if MYLIST is declared as LIST type and is passed as an argument to method MYMETHOD, SCL will first search for a MYMETHOD that accepts lists as arguments. If none is found, SCL will pass MYLIST to a MYMETHOD that accepts numeric arguments.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.