Navigation:  Programming Cookbook > Binary Filing Objects >

Storing globals

Previous pageReturn to chapter overviewNext page

Do you need to make a filed-out object into a Smalltalk global variable automatically when it is filed back? If so, then you can use STBOutFiler>>#register:asGlobal: before filing out the object (or any references to it) to achieve this. The first parameter is the object which is to be made global and the second is its global symbol. #register:asGlobal: does no output itself but when the object is subsequently #nextPut: it marks the object such that when it is subsequently loaded it will be installed as a global with the given symbol.

You may register a global whose value is nil provided that nil is subsequently #nextPut:. Similarly, it is also OK to register the same object with several different global names provided the object is subsequently #nextPut: the corresponding number of times.