Squeak (file system & project structure) newbie questions
Bert Freudenberg
bert at impara.de
Mon Oct 24 11:47:45 UTC 2005
In most popular OO languages, objects are but a runtime artifact. The
program only contains blue-prints for objects, every time you run the
program, it creates all objects from scratch. In contrast, in
Smalltalk, you create the objects you need only once, and then work
with them continuously. "Saving an image" really only freezes the
object memory at one point in time and dumps it to the disk. This
image contains *everything* - your objects and the "system" objects.
That's why you cannot "load one image into another" - you would have
two instances of True or False or class Object etc.
So to take only *some* objects from one image to another, you cannot
use the whole image, but just a part of it. This is called an "image
segment", which can be saved to disk and reloaded in a different
image. The problem is how to actually determine *which* objects to
include in that segment. If you imagine all objects in the image as
nodes in a graph connected by references as edges, you would need to
find a subgraph which could be stored. That's what projects are - a
way to identify a group of objects that make up a working whole,
driven by the UI. In a sense, you can think of a project as an
"application" running on "Squeak" as the operating system. You create
a new project, which looks like an empty desktop, then create your
objects (open Morphic windows etc) and save it (which creates an
image segment that is dumped to disk). You might want to read the
comment of class Project, which describes this in more detail.
A problem why this project mechanism has not been adopted even by
most of the squeak.org crowd (in contrast to the squeakland.org
folks) is that it was not developed for code you create in the
Smalltalk browser. Projects distinguish between system classes
(defined in a browser) and user classes (defined by writing scripts).
User classes are included automatically in a project, system classes
are not. To bridge that gap, you can manually choose to include code
(the code in the current changeset) when saving a project. This code
is attached in textual form before the image segment, which makes it
vastly more inefficient than the code in user classes, because it has
to be compiled when loading.
Nowadays we actually *do* have the means of distinguishing code
provided by the system and that written by the user in a browser -
namely by using packages, which did not exist when the project
mechanism was conceived. So we could now extend the idea of projects
to "larger" applications involving both live objects and larger
chunks of costume code, but AFAIK nobody has done any real work in
that direction, yet. Maybe the "modules" team will come up with
something along these lines.
- Bert -
Am 24.10.2005 um 11:17 schrieb untz:
> Thanks for all the helpful information, gentlemen...
>
> On Mac OS X Tiger, the equivalent of win32 executable (.exe)
> is .app, therefore the Squeak 3.8.6Beta6.app is the virtual machine.
>
> Ok, I got the hang of it now... Now what are the .pr files for and
> how does one use them instead of .st files and .image files?
>
> Do people pause / resume there work in Smalltalk loading the .pr
> files or the .image files or the .st files (it does seem that
> the .st files only contain one small source listing)....
>
> Many, many thanks!
>
> Kindest regards,
>
> Unnsse
>
> On Oct 24, 2005, at 12:56 AM, Steffen Märcker wrote:
>
>> To run an image, open it with the virtual machine (e.g. squeak.exe
>> on Win), not within a running Squeak.
>> Remember that images are similar to memory snapshots. (analogous
>> to what's written on the hard disk during "Suspend to Disk" on an
>> ACPI computer). Consequently opening an image in Squeak means
>> opening the file and see what it contains (the archaic code) -
>> just like opening it with any other editor.
>>
>> Hope this helps a bit...
>> Steffen
>>
>>
>> --
>> Erstellt mit M2, Operas revolutionärem E-Mail-Modul: http://
>> www.opera.com/m2/
>>
>>
>
>
>
More information about the Squeak-dev
mailing list
|