fix to Random>>next: 1.0 should not be included in return values
[k8lst.git] / samples / proxy.st
blob2a923993f2269d8e4a7bbbec9710b493cd659998
1 class: TestClass [
2   | id |
4   ^new: aId [
5     | obj |
6     obj := self new.
7     self in: obj var: #id put: aId.
8     ^obj
9   ]
11   run [
12     id printNl.
13     'TestClass>>run' printNl.
14     self class print.
15     '>>' print.
16     thisContext method name printNl.
17   ]
20 proxy: TestProxy [
21   | obj cnt |
23   ^new [
24     | obj |
25     '10' printNl.
26     (obj := self basicNew) initialize.
27     '11' printNl.
28     ^obj
29   ]
31   initialize [
32     cnt := 42.
33   ]
35   doesNotUnderstand: aSel args: aArgs [
36     '!!!!' printNl.
37     obj printNl.
38     aSel printNl.
39     "aArgs printNl."
40     '00' printNl.
41     obj ifNil: [ obj := TestClass new: cnt. cnt := cnt + 1 ].
42     '01' printNl.
43     obj printNl.
44     ^obj perform: aSel withArguments: (aArgs from: 2).
45   ]
49 {[:px |
50    px := TestProxy new.
51    px run.
52    px run.
53  ] value