Design Principles Behind Smalltalk (1981)
cs.virginia.edu
cs.virginia.edu
I loved coding in Smalltalk years ago. Guess “better” turned out to be rather subjective...
Take Javascript, for example. It's the top language on Github. Its not there because its everyone's favorite language, or because it's an ideal language for writing reliable software. Its there because its baked into web browsers. We're now starting to get full-featured reliable compilers into JS with sourcemaps and whatnot, plus things like webassembly. So it's becoming quite reasonable these days to write code for the web in a language that isn't JS and not feel like a second-tier citizen. But that hasn't always been the case, so people wrote a lot of JS out of necessity. And that's why it's at the top.
(I don't mean to riff on JS in this post. There are plenty of other opportunities for that. The language has improved over the years, and this is surely part of the reason it's remained at #1, and part of the reason why browser vendors didn't throw up their hands and try a different language instead. But the main reason its at the top is because it's the language of the web.)
If SmallTalk were built into browsers instead of JS, then we'd all be writing SmallTalk. And it'd be blazing fast. And that has nothing to do with how sound its design is.
And as justinpombrio says above, that has nothing to do with how good or bad the language is.
One could only dream of how nice the programming world would be, if Sun had pushed Smalltalk instead of Java. Ironically, Hotspot started its life as a Smalltalk VM and only when Sun took over the development was turned into a Java VM.
To make things even worse, Parcplace merged with their main rival, Digitalk, which offered Smalltalks for PCs and Macs for $100 to $500. They promptly replaced those with "enterprise" products costing way more making it impossible for new people to learn the language except with toy implementations like Little Smalltalk and GNU Smalltalk (which later evolved into a very decent implementation). For some reason the nice Smalltalk/X (commercial, but free for educational use) only had a small niche in Europe.
Note that Sun already had a Smalltalk in the form of Self, but Java was created anyway and Sun decided to use it exclusively killing Self and Tcl (which spun off instead of dieing). Part of the Self group merged with a group researching Smalltalk with optional type declarations (Dart is the latest version of that) to create the company Animorphics to develop StrongTalk.
Meanwhile, the Pep project at Sun demonstrated that you could run Java on the Self VM and greatly outperform all existing Java implementations (which were simple bytecode interpreters). The Animorphics team did the same and showed off Java on their VM, which caused Sun to buy them to make this demo into the HotSpot VM.
Shudder
(Yes, modern PHP is okay, but there are still a thousand and one bits of legacy baggage from a darker time that yet remain to be fixed - things like sane process control (PHP can't reliably access subprocess return values!), standard I/O support (can't read from stdin one char at a time, so sane CLI tools are broken), DB sanity (the SQLite3 extension will run all queries twice unless you code around bugs that have been known about for 10 years), etc), socket I/O (you physically cannot write rock-solid sockets code; the builtin streams functionality _and_ the socket extension do not provide enough surface area to handle all plausible error conditions, and it's entirely possible your script will hard-crash in certain obscure scenarios because the runtime doesn't give you the ability to trap all errors), and because of these longstanding issues PHP _does still have_ a sad culture of "it's okay, we'll just do this crazy horrible workaround", and nobody's fixing it.
I wanted to give a practical example, but unfortunately I can't find it. I was debugging some incredibly confusing socket behavior one day, and found where a major library/framework had hit exactly the same problem, and what they did - it was a remarkably well-engineered solution - was to setup a custom error handler, preg_match() the PHP error string (!) inside the error handler, then use some magic "if this is set to this and that var equals that value" derived from reading the PHP source code to detect a socket error condition. This code is still in place since PHP 7 hasn't fixed any of this, I just can't remember the library name or where to look for the code unfortunately.
</rant>
So, the language may be well-strucuted, concise, extensible, etc. but natural selection may depend, for example, on availability for mobile platforms. In which case, languages that flourish on mobile platforms (e.g. browser-resident JavaScript) will survive that measure of "fitness".
The same is true in biology. What may seem well-formed, robust, and inevitable is meaningless to the process of natural selection. Nature randomly and arbitrarily chooses what those species that are fittest.
People too often mistake "survival of the fittest" to mean "survival of the most beautiful" or "survival of the most logical" because they consider existing species as fit by applying post hoc ergo propter hoc logic.
I bet if everyone were exposed equal parts to smalltalk, javascript, haskell, lisp and python you will see an entirely different paradigm.
-ss
-ss
If anything, among more "modern" languages, I would think that the closest thing to Smalltalk is Ruby.
EDIT: Here's an example piece of code of Smalltalk:
#(1 2 3 4 5) select: [:i| i odd ]
in the equivalent Ruby: [1,2,3,4,5].select {|i| i.odd? }This is what most people miss when comparing languages.
There's also REPLs for Smalltalk, but none for Java due to it's syntactic structure that prevents top-level statements.
That sounds like Smalltalk leads to far different development experiences compared to Java.
In other words, I can't think of how anything between Smalltalk and Java could be similar (at least more so than comparing it to any other programming language). Could you expand on that?
[1] http://web.cecs.pdx.edu/~harry/musings/SmalltalkOverview.htm...
To this day it still contains the Smalltalk style code browser for Java code. REPL like experience in Eclipse was done via Scrapbook, which are similar to transcripts.
And as of Java 9 there is an official REPL on the JDK.
The workspace concept in Eclipse is based on the idea of having a kind of virtual image based on files.
JVM debugging capabilities support edit and continue, then there are tools like JRebel that take advantage of class loaders to extend the code replacement capabilities.
Eclipse has its own Java compiler that does incremental compilation on file save.
Java collections introduced in version 1.2 are influenced by Smalltalk collection classes.
Also note that I didn't state it was the same thing, rather "the only ones close enough to the experience.".
> Eclipse has its own Java compiler that does incremental compilation on file save.
Unfortunately, this seems to be the other kind of incremental compilation, different from Smalltalk's or Lisp's. As far as I can see, it simply results in faster compilation, and not in run-time program modification.
Again I am not saying you can do everything that Smalltalk allows for, after all it enjoys the flexibility of a dynamic language, just that those environments (.NET and Java) are the closest to the overall experience, from the point of view of someone that used Smalltalk/V back in its golden days.
The dynamism of those IDEs can be traced back to what Xerox PARC was doing on their Mesa/Cedar developer's environment.
http://toastytech.com/guis/cedar.html
https://archive.org/details/bitsavers_xeroxparcteCedarProgra...
These ideas influenced the IDE experience of other statically typed languages.
But for overall development experience, modern industrial C# and Java developer environments may be closer to the Smalltalk dev experience.
-ss
Java and .NET are based on VM with mixed execution models, interpreted, AOT and JIT to native code.
Their semantic model is closer to Smalltalk, with GC, dynamic loading, incremental compilation, ability to change code in debug mode and continue, reflection, dynamically generate bytecode on the fly, ....
BTW I just found out that, apparently, C++ Builder is, sort of, still alive. The most recent release is "10.2 Tokyo / March 22, 2017". I thought it was dead for a decade or so.
-ss
Currently on mobile, not so easy to provide a link.
I don't see myself spending more time working with Smalltalk, as it stands today. It's single threaded, which is fine for a lot of tasks but is (in my opinion) a poor fit for a GUI environment. Having looked around at projects like Pharo, it looks like the Smalltalk community may be moving away from the idea of Smalltalk presenting the whole environment for the end-user, instead providing one application (often one that presents no UI, i.e. a web application).
From a personal standpoint, I would be very interested in a Smalltalk-like environment that I could use to develop my own software and, hopefully, use to replace a lot of the smaller bits and pieces I use to get my work done. Perhaps it could provide an IDE that I could also use to replace Emacs (which I also use for mail) and an IRC/chat client I could use to replace Weechat (which I also use for Slack, Google Talk and Facebook Messenger).
I don't feel a great affinity for many of the tools I use daily (email, chat, calendar, etc.), in part because they are not easy for me to alter or improve. It's funny: Emacs is clunky and weird, but I stick with it because it's easy for me to add or change the way it works.
I wonder if a Smalltalk implementation that revolved around objects implemented as actors passing messages (as opposed to the direct calling of methods that we have today) would be more amenable to multi-threading, yet still retain the simplicity that Smalltalk enjoys today.