GNU Smalltalk 3.1
GNU Smalltalk 3.1 has been released at
Compared to the 3.0.x branch, focus on porting libraries from other Smalltalks, adding bindings to other external libraries, and facilitating the creation of C/Smalltalk interfaces.
More in detail, changes between 3.0.5 and 3.1 include the following.
New base class features
#cull:cull:cull:evaluate blocks removing parameters that are not accepted by the block.
- Thanks to this new functionality, the parameter to
#ifNotNil:can be omitted.
RegexResultsmethod #ifMatched:ifNotMatched:, and other similar methods, also accept either zero or one-argument blocks. In 3.0.x,
#ifMatched:accepted a one-argument block, while
#ifNotMatched:accepted a zero-argument block.
- Thanks to this new functionality, the parameter to
Streams have a common superclass, Iterable. The user-visible aspect of this is that
Streams now enjoy a wider range of iteration methods, such as
CObjects can be backed with garbage-collected (as opposed to heap-allocated) storage. Using this is not always possible, for example for CObjects stored by external libraries or passed to functions that call back to Smalltalk or otherwise may cause garbage collections. If it is, however, it is easier to use, faster and more predictable than finalization. As an added benefit, accesses to garbage-collected
CObjects are bounds-checked. Garbage-collected
CObjects are created by sending
#newto instances of
- It is possible to create C call-outs that are not attached to a function that the VM knows about, using the method
CCallable class>>#for:returning:withArgs:. The returned object can then be used to create CompiledMethods using
CompiledMethod class>>#cCall:numArgs:attributes:. The address however is reset to NULL on image restart and it is up to the user to reinitialize it. You can also subclass
CCallableand override the
#linkmethod (the existing
CFunctionDescriptorclass is now implemented on top of this).
ObjectMemory>>#snapshot:return false in the instance of GNU Smalltalk that produced the snapshot, and true in the instance of GNU Smalltalk that was restored from the snapshot. Note that this does not apply to
CallinProcesses, since those are stopped in saved images.
- Packages can specify start/stop scripts. Start scripts can be activated with gst-load, while both start and stop scripts are supported by the new tool gst-remote (see below).
- Processes support thread-local variables, which are accessed through a special dictionary returned by
- Streams have a set of new methods that allow to eliminate useless copies when moving data from stream to stream, as well as to eliminate useless creation of collections to store the data read from a stream. Besides the standard methods
#atEnd, three more methods can be implemented by Stream subclasses in order to achieve better performance on block transfers, namely
#next:putAll:startingAt:. Another set of new methods was added to Stream, in order to provide an easier to use API on top of the basic block-streaming API described above; you should not need to override them. These are
New environment/language features
- Error backtraces include line numbers and filenames.
- Imports were added to namespaces (via the
<import: ...>pragma, as for classes). Unlike the superspace, imports are not made visible through
#at:. The design and implementation of this feature was done by Stephen Compall.
- The order for searching pool dictionaries changed. The new order, codenamed "TwistedPools", builds on three ideas: 1) the environment of a class always has lower priority than the imports, so the environment is always excluded from the imports if the environment is a superspace of the imports; 2) apart from this, the imports are visited in topological order, so that if two imports have a superspace in common, the imports are always visited before the superspace; 3) each class in the inheritance order is visited separately, so the imports of a superclass have lower priority than the environment of the subclass. The design and implementation of this feature was also done by Stephen Compall.
- The source code for methods loaded from
Streams that are not
FileStreams is stored directly in the image. This is actually a bugfix, but it was not possible to backport it to the 3.0.x series because the fix depends on the new virtual filesystem implementation (see below)
FileStreamraise an exception if
#next:cannot return the given number of bytes.
FileDescriptoris now a subclass of Stream.
Haltis now a subclass of
ObjectDumpernow accepts normal
Stringstreams. The class
ByteStreamhas been removed.
Stream>>#nextHunkwas removed. Applications can use #nextAvailable: or, better, should be rewritten to use new stream-to-stream protocol such as #nextAvailablePutAllOn:.
- The VFS subsystem was rewritten. Virtual filesystems are now accessible via special methods on
File>>#zip, for example
(File name: 'abc.zip') zip) and not anymore with special filenames that could conflict with real files. Incompatible changes caused by this include:
- methods like
Directory kernelreturn a
Fileobject, not a
Directoryobjects are not created anymore and instead File objects also support the directory enumeration protocol;
Fileobjects rather than file names to the block;
Directory>>#contentsis now called
- virtual files are not anymore instances of
File; extension methods that also apply to virtual files should be added in
- methods like
- The semantics of
#on:do:were changed: executing off the end of an exception handler will always return from the associated
#on:do:. Older versions of GNU Smalltalk either returned or resumed depending on the resumability of the exception.
New VM features
gst_async_signal_and_unregisterare now thread-safe, *not* async-signal-safe. This is more useful, and is a feature more than an incompatible change. To trap signals from Smalltalk, you have to use
- If possible, the installation is made relocatable. To this end, the following conditions should be satisfied: 1) the exec-prefix and prefix should be identical; 2) the installation should reside entirely within the prefix; 3) on Windows, the bindir and libdir should be the same or shared libraries should be disabled; 4) if neither on Windows nor under a glibc-based system, shared libraries should be disabled. If the above conditions are satisfied, and you want a relocatable install, it is suggested that you configure with a non-existent prefix such as "--prefix=/nonexistent". To move the installation, you can install into a staging area and move it from there.
./configure --prefix=/nonexistent make make install DESTDIR=`pwd` (cd nonexistent && tar cvf - .) | (cd $HOME && tar xvf -) (cd nonexistent && tar cvf - .) | (cd /usr/local && tar xvf -)
- In order to support relocatable installation,
libgstclients should call
gst_initialize. Failure to do so won't cause any problem, except that relocatable installation will be disabled and the program will look for its files only in the configured prefix.
- DBI supports querying tables for schema information, and is integrated with the "ROE" (Relational Object Expression) package by Avi Bryant. ROE support is present for all back-ends (MySQL, PostgreSQL, SQLite).
- The SQLite backend supports stored procedures (contributed by Daniele Sciascia).
- Sockets (formerly TCP):
- IPv6 and AF_UNIX sockets. IPv6 support is transparent if your system is configured appropriately. In order to use AF_UNIX sockets, just specify the socket name as the "port" and "Sockets.UnixAddress uniqueInstance" as the host.
- The sockets package (and the namespace it is installed in) was renamed from TCP to Sockets. While the old namespace is still available for backwards compatibility, it is suggested to use the Sockets namespace instead.
- Unbuffered sockets available from class Sockets.StreamSocket.
- A new installed tool gst-remote allows remote control of a GNU Smalltalk VM via a TCP socket, possibly via ssh.
- Bindings to Cairo and LibSDL provided by Michael Bridgen, Tony Garnock-Jones and Brad Watson.
- Bindings to OpenGL and GLUT contributed by Olivier Blanc.
- Magritte object-model description framework by Lukas Renggli.
- ROE (see above).
- Seaside application server/web framework by Avi Bryant, Julian Fitzell, Philippe Marschall, Lukas Renggli and others. The version of Seaside included is a snapshot of 2.9 from last February, which is similar to 2.8 except for some deprecated APIs; a new release of GNU Smalltalk 3.1.x will be published supporting 2.9 final when it comes out.
- Swazoo web server by Bruce Badger, Janko Mivsek and others.
Thanks to the above-mentioned contributors, and to Thomas Girard for testing of the prereleases.