[Cuis-dev] (no subject)
ken.dickey at whidbey.com
ken.dickey at whidbey.com
Mon Mar 6 14:58:33 PST 2023
On 2023-03-06 14:19, Alexandre Rousseau via Cuis-dev wrote:
> Hi. I'm reading the CUIS book. This has been a good, pleasant
> experience thus far.
Happy to hear that this is the case.
> Appending G lists the (package) source for SpaceWar. For various
> reasons, I decided to enter the contents of that package manually, via
> the browser, rather than install it by package loading.
>
> And this when I stumbled on the last 2 lines of that package:
>
> SpaceShip initialize!
> Torpedo initialize!
>
> These 2 lines don't seem to belong to a method.
Smalltalk tries hard to keep source code and the live data and compiled
runtime in synch so that you can go back and forth between source and
compiled code and data. Another way of saying this is that many
programming languages "compile away" the "metadata". Smalltalk keeps
the metadata, so that you get great "source level" inspection and
debugging.
While the Chunk File Format must be formally "strict" so that it can be
read in by the VM, it is sometimes helpful to be able to easily read
Package and Change files ourselves.
In the Code Browser, when you create an #initialize method for a Class,
the method is invoked when it is compiled.
For packaged code, the method is compiled but is _not_ invoked until all
the code in the package has been loaded. This is to be sure that the
things an #initialize method needs to do have their code installed
first.
So each Class #initialize method included in a Package is invoked at the
end of that Package.
So like other Package business (comment, provides, requires) Class
Initialization is just a bit of mechanics which is "spelled out" in
text.
HTH,
-KenD
More information about the Cuis-dev
mailing list