CheapBlock.st
changeset 2247 3e227e6ea1fb
parent 2243 adf9680a593e
child 2694 46ba8cbdc013
equal deleted inserted replaced
2246:57451418f10a 2247:3e227e6ea1fb
   103     method := aMethod
   103     method := aMethod
   104 
   104 
   105     "Created: 21.10.1996 / 13:58:29 / cg"
   105     "Created: 21.10.1996 / 13:58:29 / cg"
   106 ! !
   106 ! !
   107 
   107 
       
   108 !CheapBlock methodsFor:'conversion'!
       
   109 
       
   110 beVarArg
       
   111     "convert myself into a varArg block;
       
   112      this one has 1 formal argument, which gets the list
       
   113      of actual arguments when evaluated."
       
   114 
       
   115     nargs ~~ 1 ifTrue:[
       
   116         self error:'vararg blocks must take exactly 1 argument - the arg list'.
       
   117         ^ nil
       
   118     ].
       
   119 
       
   120     self changeClassTo:VarArgCheapBlock.
       
   121     ^ self
       
   122 
       
   123     "
       
   124      |b|
       
   125 
       
   126      b := [:argList | argList printCR] beVarArg.
       
   127      b value.
       
   128      b value:'arg1' value:'arg2' value:'arg3' value:'arg4'
       
   129     "
       
   130 
       
   131     "Created: 23.1.1997 / 13:35:28 / cg"
       
   132     "Modified: 23.1.1997 / 13:35:48 / cg"
       
   133 ! !
       
   134 
   108 !CheapBlock methodsFor:'printing & storing'!
   135 !CheapBlock methodsFor:'printing & storing'!
   109 
   136 
   110 printOn:aStream
   137 printOn:aStream
   111     "append a a printed representation of the block to aStream"
   138     "append a a printed representation of the block to aStream"
   112 
   139 
   138 ! !
   165 ! !
   139 
   166 
   140 !CheapBlock class methodsFor:'documentation'!
   167 !CheapBlock class methodsFor:'documentation'!
   141 
   168 
   142 version
   169 version
   143     ^ '$Header: /cvs/stx/stx/libbasic/CheapBlock.st,v 1.17 1997-01-23 12:45:23 cg Exp $'
   170     ^ '$Header: /cvs/stx/stx/libbasic/CheapBlock.st,v 1.18 1997-01-23 14:23:39 cg Exp $'
   144 ! !
   171 ! !