| 158 | |
| 159 | ==== Method Parameter List ==== |
| 160 | |
| 161 | A parameter list is a comma separated list of name (and optionally type and parameter description modifier) specifications |
| 162 | |
| 163 | {{{ |
| 164 | <paramName> [as [<paramDesc>] <Type>] [, ...] |
| 165 | }}} |
| 166 | <paramDesc> is optional and may be '''vari''' and/or a parameter direction indicator '''out''' or '''inout''' ( default if unspecified is '''in''')[[BR]] |
| 167 | |
| 168 | '''vari''' indicates the parameter name is a placeholder for a variable length arglist. Within the method this may be unpacked/accessed as a list.[[BR]] |
| 169 | |
| 170 | '''in''' (implicit) Args are only passed into the method. Any changes made to the argument inside the method are not visible outside the method (pass-by-value)[[BR]] |
| 171 | |
| 172 | '''out''' the arg is returned from the method [[BR]] |
| 173 | |
| 174 | '''inout''' argument is both passed into the method and (any possibly changed) value is also returned from the method (pass-by-reference)[[BR]] |
| 175 | |
| 176 | |
| 177 | If <Type> is unspecified it is treated as dynamic?[[BR]] |
| 178 | |
| 179 | |
| 180 | e.g. |
| 181 | {{{ |
| 182 | def meth( a, b is String, c is out String) |
| 183 | c = b + "_meth" |
| 184 | |
| 185 | def sum(a as vari int) as int |
| 186 | sum = 0 |
| 187 | for i in a |
| 188 | sum += i |
| 189 | return sum |
| 190 | }}} |
| 191 | |
| 192 | meth takes 3 args , the first and second are inward only and are dynamic and a string respectively, the third is only returned from the method as a string |
| 193 | sum takes a variable number of integer args |
| 194 | |
| 195 | |
| 196 | == Generics == |
| 197 | +++TBD+++ Generics |
| 198 | |
| 199 | |