3 ms·
I can't speak to historical Smalltalk -- maybe Alan Kay or Dan Ingalls will come on thread to clarify -- but its lineal descendants, Squeak and Pharo, absolutel
by bitwize 4y ago
I can't speak to historical Smalltalk -- maybe Alan Kay or Dan Ingalls will come on thread to clarify -- but its lineal descendants, Squeak and Pharo, absolutely do store sources in separate files on disk -- for Squeak, in the SqueakVxx.sources and <image name>.changes files respectively. These aren't really databases, either, just blobs of Smalltalk source each of which contains class definitions and method updates linearly serialized; the Smalltalk system knows how to walk and index them to find the source for a particular method. Contrary to popular belief, the image is not used to store smalltalk source; if you remove either of these files, the Smalltalk system can recover source code for compiled methods in the image from the compiled bytecode, but things like local variable names will be lost. The source files are not intended to be hand-edited directly, of course, but you can, theoretically, do it.
- jillesvangurp 4y agoI was probably using visual works at the time I used it (briefly). https://en.wikipedia.org/wiki/VisualWorks https://en.wikipedia.org/wiki/VisualWorks I basically never saw any source files. According to wikipedia, you could export them though. But it's a long time ago and I never did much with smalltalk. I was still in university and this was part of our object oriented programming course. A file that is easy to read and index sounds like a database to me. Not an sql database obviously.
- bitwize 4y agoVisualWorks was probably way different. But I've heard "Smalltalk had no source files, it stored all its program source in the image" enough times in a variety of contexts that I felt the need to address it.
- pjmlp 4y agoThe fact that the files aren't meant to be hand edited already makes it quite clear how it goes, not every kind of image file is a binary blob. That is why there are export/import tools.
- igouy 4y agoVisualWorks was the same https://news.ycombinator.com/item?id=32432411 https://news.ycombinator.com/item?id=32432411 except when it was using ENVY/Developer https://www.google.com/books/edition/Mastering_ENVY_Developer/ld6E19QIMo4C?hl=en&gbpv=1 https://www.google.com/books/edition/Mastering_ENVY_Develope... Also my guess is that with Gemstone the code was in the database (but I am just guessing). https://gemtalksystems.com/products/gs64/ https://gemtalksystems.com/products/gs64/
- jdougan 4y agoIn traditional Smalltalks, all the method objects have a shared object representing the file that method source is stored in (either .sources or .changes, with room for more) and an offset in the method to point to the text. On compilation, all it does is write the new method with metadata to the end of the .changes file, then set the text indexes. There is a mechanism to crunch out all the unused source text and generate a new merged .sources file. If you are all working on the same base version, .sources files can be shared since they are usually read only. The nice part of doing this is you don't have to use much core for the method source, which was a big deal in 1978. You can easily strip the sources and changes files if you don't need them. eg. when distributing a build to customers. It also lets you remember the change history and enables recovery from crashes and other errors. The basic mechanism is also fairly easy to repurpose to support other change tracking approaches. The interesting trick, is if you don't have a .sources or .changes, the system will run the Decompiler, which almost always produces readable code that is structured like the original source but with no comments and the local variable names changed to t0, t1, t2,... etc. There have been proposals to keep local var names in the image as to make it a bit less painful. It is surprisingly easy to code like this. There have also been proposals to store the whole source text in the image. You could do it and it wouldn't be hard, but you'd lose the advantages of the external code storage. This does not count the various project facilities and change lists so you can keep related changes grouped.
- igouy 4y ago`jillesvangurp` may be talking about ENVY/Developer -- "All code is stored in a central database rather than in files associated with a particular image." page 4 https://www.google.com/books/edition/Mastering_ENVY_Developer/ld6E19QIMo4C?hl=en&gbpv=1 https://www.google.com/books/edition/Mastering_ENVY_Develope...