Debian Codegraph @

terps/tads/tads3/test/data/mod_obj.t

raw
1 #include "tads.h"
2
3 corePrint(val, obj)
4 {
5 tadsSay('core: val=<');
6 tadsSay(val);
7 tadsSay('>\n');
8 }
9
10 modify Object
11 print(x)
12 {
13 corePrint(x, self);
14 }
15 ;
16
17 modify Collection
18 print(x)
19 {
20 tadsSay('collection: val=<');
21 tadsSay(x);
22 tadsSay('>self=[');
23 local first = true;
24 foreach (local obj in self)
25 {
26 if (!first) tadsSay(',');
27 first = nil;
28 tadsSay(obj);
29 }
30 tadsSay(']\n');
31 }
32 ;
33
34 myObj: object
35 foo = nil
36 ;
37
38 main(args)
39 {
40 myObj.print('hello');
41 [1, 2, 3].print('bye');
42 }
43