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@2 | 1 | class C: |
paul@2 | 2 | x = 3 |
paul@2 | 3 | |
paul@2 | 4 | def f(): |
paul@2 | 5 | x = g.x |
paul@266 | 6 | print x # 3 |
paul@2 | 7 | y = g |
paul@266 | 8 | print y # __main__.C |
paul@2 | 9 | return y.x |
paul@2 | 10 | |
paul@266 | 11 | def i(): |
paul@266 | 12 | x = h.x |
paul@266 | 13 | y = h |
paul@266 | 14 | return y |
paul@266 | 15 | |
paul@2 | 16 | g = C |
paul@2 | 17 | result = f() |
paul@266 | 18 | print result # 3 |
paul@266 | 19 | |
paul@266 | 20 | h = C |
paul@266 | 21 | print i() # __main__.C |
paul@266 | 22 | print i().x # 3 |
paul@266 | 23 | |
paul@266 | 24 | h = C() |
paul@266 | 25 | print i() # <__main__.C instance> |
paul@266 | 26 | print i().x # 3 |