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 | def f(): |
paul@2 | 2 | s = "test" |
paul@2 | 3 | m = s.__len__ |
paul@2 | 4 | n = "test".__len__ |
paul@266 | 5 | print m # __builtins__.str.basestring.__len__ |
paul@266 | 6 | print m() # 4 |
paul@266 | 7 | print n # __builtins__.str.basestring.__len__ |
paul@199 | 8 | print n() |
paul@2 | 9 | |
paul@2 | 10 | def g(): |
paul@266 | 11 | l = [1, 2] |
paul@2 | 12 | m = l.__len__ |
paul@266 | 13 | n = [1, 2].__len__ |
paul@266 | 14 | print l # [1, 2] |
paul@266 | 15 | print m # __builtins__.list.list.__len__ |
paul@266 | 16 | print m() # 2 |
paul@266 | 17 | print n # __builtins__.list.list.__len__ |
paul@266 | 18 | print n() # 2 |
paul@2 | 19 | |
paul@2 | 20 | f() |
paul@2 | 21 | g() |