Changes between Version 1 and Version 2 of Delegates
- Timestamp:
- 11/22/10 19:31:59 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Delegates
v1 v2 18 18 e.g 19 19 {{{ 20 #!cobra 20 21 sig FunctionWithOneIntArgAndReturnsBool(i as int32) as bool 21 22 }}} … … 26 27 invoking the delegate. 27 28 {{{ 29 #!cobra 28 30 # The following declares a delegate (type) named Del that can 29 31 #encapsulate a method that takes a string as an argument and returns void: … … 47 49 == Grammar == 48 50 {{{ 51 #!cobra 49 52 # delegate definition 50 53 sig TYPENAME(ARGS) as TYPE … … 61 64 == Examples == 62 65 {{{ 66 #!cobra 63 67 class SigEG 64 68 sig IntTest(i as int) as bool … … 74 78 75 79 {{{ 80 #!cobra 76 81 # as above using an anon function 77 82 tester as IntTest = do(i as int) … … 92 97 so currently delegate variable definitions need a type definition. 93 98 {{{ 99 #!cobra 94 100 name as SIGTYPENAME = ref METHOD 95 101 # rather than just