more fixes to X11
[k8lst.git] / NOTES
bloba7fa7a8c42053f344e7ed16e324d1004c328c68e
1 all classes with class variables should be created in image builder, so
2 we can allocate space for class variables.
5 binary message '/' always returns integers. to get float result one
6 should do something like (3 asFloat / 5).
9 LST has funny special form of inline array:
10   #{ + / * }
11 this array will be treated as list of symbols separated by spaces.
14 for primitive handlers:
15 remember, that any allocation except lstNewInt() can trigger GC
16 and invalidate all non-static object pointers (except arguments).
17 to avoid this you can keep your values in lstRootStack.
18 VM will clear all pushed stack values when primitive handler returns.
19 see lstRootPush() and lstRootPop().
22 this will not work:
23   class: Test | fac | [
24   ^init [
25     fac := [:n :r |
26       'n: ' print. n printNl.
27       n > 1
28         ifTrue: [ r := n * (fac value: n - 1) ]
29         ifFalse: [ r := 1 ].
30       'r: ' print. r printNl.
31       r
32     ].
33     (fac value: 5) printNl.
34   ]
35   ]
36   { Test init }
37 blocks are not real closures, and running block can't be
38 invoked from the same (or another) running block. sorry.
41 remember that inter-group block returns WILL NOT work.
42 such return will probably break the interpreter.
45 doesNotUnderstand message
46 doesNotUnderstand: selector arg: argarray
47 argarray is the full argument array (note that 1st item is 'self')
50 note, that simple getters and setters (and simple 'constant returns')
51 are virtually painless, as they will be inlined by the MyCoolAnalyzer.
54 ifNil:
55 ifNil: is actually a 'nil filter': it returns it's receiver if it is
56 not nil.
59 ifTrue: or ifFalse: return value
60 note, that upon unsuccesfull check, ifTrue: will return false,
61 and ifFalse: will return true. in Squeak they seems to return
62 nil.
65 st-finalizers (modelled after GST)
66 the following description was copied from GST manual.
68 Object>>addToBeFinalized
69 Marks the object so that, as soon as it becomes unreferenced,
70 its #finalize method is called. Before finalize is called,
71 the VM implicitly removes the objects from the list of
72 finalizable ones. If necessary, the finalize method can mark
73 again the object as finalizable, but by default finalization
74 will only occur once.
76 Note that a finalizable object is kept in memory even when it
77 has no references, because tricky finalizers might resuscitate
78 the object; automatic marking of the object as not to be
79 finalized has the nice side effect that the VM can simply delay
80 the releasing of the memory associated to the object, instead of
81 being forced to waste memory even after finalization happens.
83 An object must be explicitly marked as to be finalized every time
84 the image is loaded; that is, finalizability is not preserved by
85 an image save. This was done because in most cases finalization
86 is used together with operating system resources that would be
87 stale when the image is loaded again.
89 Object>>removeToBeFinalized
90 Removes the to-be-finalized mark from the object. As I noted
91 above, the finalize code for the object does not have to do
92 this explicitly.
94 Object>>finalize
95 This method is called by the VM when there are no more references
96 to the object.
99 weak objects
100 the following description was copied from GST manual.
102 Object>>makeWeak
103 Marks the object so that it is considered weak in subsequent garbage
104 collection passes. The garbage collector will consider dead an object
105 which has references only inside weak objects, and will replace
106 references to such an almost-dead object with nils, and then send the
107 #mourn message to the object.