cfad47cfa3/t3compiler/tads3/test/data/mod_obj.t

4b825dc642cb6eb9a060e54bf8d69288fbee4904cfad47cfa334b206c65f22086bcc5d63e6f70944
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