
1 // 2 // Copyright (c) 2006, Brian Frank and Andy Frank 3 // Licensed under the Academic Free License version 3.0 4 // 5 // History: 6 // 6 Jan 06 Brian Frank Creation 7 // 8 9 ** 10 ** Method models a function with a formal parameter list and 11 ** return value (or Void if no return). 12 ** 13 class Method : Slot 14 { 15 16 ////////////////////////////////////////////////////////////////////////// 17 // Constructor 18 ////////////////////////////////////////////////////////////////////////// 19 20 ** 21 ** Dynamic slot constructor. Dynamic methods take an implementation 22 ** function which defines the return type and parameters of the method. 23 ** 24 public new make(Str name, Func func, Str:Obj facets := null) 25 26 ////////////////////////////////////////////////////////////////////////// 27 // Signature 28 ////////////////////////////////////////////////////////////////////////// 29 30 ** 31 ** Type returned by the method or sys::Void if no return value. 32 ** Convenience for 'func.returns'. 33 ** 34 Type returns() 35 36 ** 37 ** Get the parameters of the method. 38 ** Convenience for 'func.params'. 39 ** 40 Param[] params() 41 42 ** 43 ** Get the function body of this method. 44 ** 45 Func func() 46 47 ////////////////////////////////////////////////////////////////////////// 48 // Call Conveniences 49 ////////////////////////////////////////////////////////////////////////// 50 51 ** Convenience for 'func.call' 52 Obj call(Obj[] args) 53 54 ** Convenience for 'func.callOn' 55 Obj callOn(Obj target, Obj[] args) 56 57 ** Convenience for 'func.call0' 58 Obj call0() 59 60 ** Convenience for 'func.call1' 61 Obj call1(Obj a) 62 63 ** Convenience for 'func.call2' 64 Obj call2(Obj a, Obj b) 65 66 ** Convenience for 'func.call3' 67 Obj call3(Obj a, Obj b, Obj c) 68 69 ** Convenience for 'func.call4' 70 Obj call4(Obj a, Obj b, Obj c, Obj d) 71 72 ** Convenience for 'func.call5' 73 Obj call5(Obj a, Obj b, Obj c, Obj d, Obj e) 74 75 ** Convenience for 'func.call6' 76 Obj call6(Obj a, Obj b, Obj c, Obj d, Obj e, Obj f) 77 78 ** Convenience for 'func.call7' 79 Obj call7(Obj a, Obj b, Obj c, Obj d, Obj e, Obj f, Obj g) 80 81 ** Convenience for 'func.call8' 82 Obj call8(Obj a, Obj b, Obj c, Obj d, Obj e, Obj f, Obj g, Obj h) 83 84 }