2018-07-12 | Paul Boddie | file changeset files shortlog | Support trailing data after attributes in objects, employed by float instances to store their double-precision numeric data which needs more space than single attributes on some systems. In order to initialise such instances statically, specific object types must be indicated instead of the generic __obj type. This then requires casting to __ref of direct references to objects. Added an underflow error. Added initial testing of floating point numbers. | trailing-data |
paul@820 | 1 | class C: |
paul@820 | 2 | def __init__(.x, .y, .z): # no explicit self, attributes initialised |
paul@820 | 3 | pass |
paul@820 | 4 | |
paul@820 | 5 | def c(): |
paul@820 | 6 | return self.x |
paul@820 | 7 | |
paul@820 | 8 | class D(C): |
paul@820 | 9 | def d(): |
paul@820 | 10 | return self.y |
paul@820 | 11 | |
paul@820 | 12 | class E(D): |
paul@820 | 13 | def c(): |
paul@820 | 14 | return self.z |
paul@820 | 15 | |
paul@820 | 16 | c = C(1, 2, 3) |
paul@820 | 17 | d = D(1, 2, 3) |
paul@820 | 18 | e = E(1, 2, 3) |
paul@820 | 19 | |
paul@820 | 20 | print c.c() # 1 |
paul@820 | 21 | print d.c() # 1 |
paul@820 | 22 | print e.c() # 3 |
paul@820 | 23 | print d.d() # 2 |
paul@820 | 24 | print e.d() # 2 |