Wiki

Changes between Version 6 and Version 7 of Classes

Show
Ignore:
Timestamp:
10/05/08 03:21:55 (16 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Classes

    v6 v7  
    106106 
    107107== Properties == 
    108 ++TBDone 
     108Define a property for the class 
    109109 
    110110=== Properties Grammar === 
    111111 
    112 ++TBDone 
     112{{{ 
     113get <propName> [ as {<Type>, var}] [is <accessModifier>] 
     114set <propName> [ as {<Type>, var}   [is <accessModifier>] 
     115 
     116pro <propName> [ as {<Type>, var}] [is <accessModifier>] 
     117 
     118pro <propName> [is <accessModifier>] 
     119 
     120    get  
     121        [...] 
     122        return <value> 
     123    set 
     124        [...] # assign or otherwise do something with implicit arg "value" (passed in) to something  
     125 
     126}}} 
    113127 
    114128== Methods == 
     
    121135Without that prefix on the name the methods  the accessType is ''public, virtual'' and  
    122136it must be accessed from within method code by prefixing the name with either '''this.''' or just '''.''' .[[BR]] 
    123  
    124 +++TBD+++ paramlist[[BR]] 
    125  
    126 +++TBD+++ Generics 
    127  
    128137 
    129138=== Method Grammar === 
     
    147156or to a Superclass constructor  (using '''base.init''') - this call must be the first executable line in the init method. 
    148157 
     158 
     159==== Method Parameter List ==== 
     160 
     161A 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 
     177If <Type> is unspecified it is treated as dynamic?[[BR]] 
     178 
     179 
     180e.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   
     192meth 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 
     193sum takes a variable number of integer args 
     194 
     195 
     196== Generics == 
     197+++TBD+++ Generics 
     198 
     199 
    149200++accessing baseclass methods 
     201 
     202 
     203 
    150204 
    151205