Will it ever be possible ...
Ned Konz
ned at bike-nomad.com
Fri Jul 20 17:29:49 UTC 2001
On Friday 20 July 2001 09:29 am, "Thomas Link"
wrote:
> Thus, I would like to ask: Will it ever be
> possible to write Squeak code that can be called from "outside" Squeak?
You can call Squeak from the command line, and run it headless (i.e. without
a GUI). You can also pass it the name of a script (a text file with Smalltalk
commands in it) to execute when it starts up. Such a script could do
something and then exit.
You could strip a Squeak image to its bare minimum for such usage, removing
much of the stuff that's shipped with it. Look, for instance, at the
tiny.image that results from majorShrink. Such an image might come up very
quickly in headless mode.
But if you're interested in using Smalltalk as a scripting language, you
might be better off looking at a dialect more oriented to this use
(declarative syntax, no image file). For instance, GNU Smalltalk.
Or you could look at Ruby, which looks and feels to me kind of like a cross
between Smalltalk and Perl, and is definitely designed for this purpose.
Languages like Ruby, Python, and Perl were written with the idea of embedding
in other programs. For instance, the programmer's editor that I use (Vim) can
be compiled with an embedded Ruby, Perl, and/or Python interpreter.
> BTW, is it/will it ever be possible to strip off all Smalltalk
> classes/methods, for which it can be proven that they are not needed
> for executing a specified block, from an image? I'm thinking of
> something like this: [1 + 2] stripUnnecessary. This would result in an
> image containing only the classes and methods needed for evaluating "1
> + 2" and displaying the results.
The commercial Smalltalks usually come with some kind of stripping tool for
runtime delivery, so it _is_ possible. There's several ways to do this,
ranging from the simplistic (look at all the messages called, recursively,
and delete only messages that aren't called) to the brute-force (run the
program in the simulator and see what gets called) to the sophisticated (do a
static analysis). Results vary widely.
> Please don't hit me for asking this kind of questions. I'm only curious
> about possible uses of Squeak. I think Squeak is a really great
> environment, but I have to confess that I don't fully understand why
> its developers don't turn this into a more generally applicable tool.
Different developers see Squeak as different things. Squeak Central is not
much interested in making Squeak into a scripting language (they're more
interested in interactive, educational, and multimedia uses). Others want
Squeak to look like Windows so they can build familar applications. Others
want to use Squeak for language research. Still others use it for embedded
systems.
But you will find that Squeak is quite able to be shaped to your will.
--
Ned Konz
currently: Stanwood, WA
email: ned at bike-nomad.com
homepage: http://bike-nomad.com
More information about the Squeak-dev
mailing list
|