r/smalltalk • u/Smalltalker-80 • Feb 21 '26
SmallJS v2.0 has been released
I'm happy report the release of SmallJS v2.0.
SmallJS is a Smalltalk-80 dialect that transpiles to JavaScript, that can run in browsers and in Node.js.
The website is here: small-js.org
The full source source code is here: github.com/Small-JS/SmallJS
The website now has a Tutorial page for learning SmallJS and Smalltalk.
The Smalltalk language and core library classes are explained.
Examples can be done interactively using the online Playground.
The full Class Reference documentation is now also available on the website.
SmallJS now has full support for async, await and promises.
Almost all async calls have been converted form callbacks to promises,
making code cleaner, more concise and easier to debug.
Smalltalk library
- Core: Promise: New convenience methods for creation. Tests for 'async', 'await', 'then', 'catch' and 'finally'.
- Smalltalk: Converted callbacks to promises for modules: Fetch, File, Database, Crypto
- Core: Web Crypto API implemented with working examples in tests for AES, RSA and ECDH. These work in both browsers and Node.
Compiler
- Fixed code generation for 'await'.
- Using 'await' outside an 'async' method now gives an error, conforming to JS.
Website
- Created a new Tutorial page to learn Smalltalk and SmallJS.
- Created a new Reference page to look up class info.
9
u/paul_h Feb 21 '26
"I always knew that one day Smalltalk would replace Java . I just didn't know it would be called Ruby" - Kent Beck
s/called Ruby/on top of JavaScript/
/joke
4
u/ezeaguerre Feb 21 '26
That's awesome! Have you checked Amber Smalltalk?
Is it just transpilation with JS semantics? I mean, I guess blocks and signals/exceptions behave like JS ones right?
I rally like the "INLINE" thing to go the JS world. Is that the only way to interact with it? Can't I access the global window or document object directly from Smalltalk? It would be cool if I could do: window setTimeout: [ ... ] ms: 1000.
Anyway, great project! I'd love to use it! I'm gonna test it later! :-)
2
u/Ok_Break_7193 Aug 20 '26
u/Smalltalker-80 There are some dead links on the website under Tutorial > Desktop > NWjs. All the links under that are dead. I tried to create an issue on the website GitHub repo, but issues are disabled there.
2
u/Thin-Eggshell Mar 19 '26 edited Mar 19 '26
This is very interesting. I was thinking how much I wished something like this existed, but knew I wasn't skilled enough to try it.
I'm just curious -- have you thought about developing the inheritance model into something more powerful? I used PharoJS and was struck by how incompatible it felt for working with React (which I see elsewhere that you hate). That being said, having access to React would greatly improve adoption, and I don't personally hate React -- I value it for managing layout for me.
Yes, I probably don't understand MVC well-enough.
But I bring this up because currently I'm working on a macro and runtime for Smalltalk-like syntax in Clojurescript, and it struck me that in my current implementation, it still sucked for React, because Smalltalk's system of message-passing was insufficiently powerful, primarily because it lacks the method-combinators of the Common Lisp Object System. As a result:
self update; publish) that could ensure that modifying the state would automatically trigger a React re-render. Instead, such a call would have to be manually inserted into all methods.renderfunction that produces JSX is written, that it would automatically be wrapped in a React Component -- instead, the programmer would have to remember to do this themselves, every time, which is inconvenient.So in my ideal world for Smalltalk and React, I'd have a class Widget such that it has
And what's nice about the method combinators in class
ReactWidgetis that, for all its children, it modifies how all its child class instances interpret their messages, so that they (at least in theory) work seamlessly with React, by ensuring thatAnyway, I had this idea and wanted to share it. I think one of the reasons Javascript React requires using all the hooks and what-not is precisely because using classes are so unwieldy in Javascript. Base Smalltalk is obviously better, but lacks the features that would put React entirely into the background. But if you have method combinators of some sort, you can remove all the complexity of composing the render functions in a single parent class, and just program in objects afterward.
If you enabled React interop, I think you'd get more people willing to play with it -- certainly that seems to be what happened when Clojurescript got the Reagent and Reframe libraries to mimic React/Redux.
But even if you hate React, I'd still hope you look at method combinators. I think there's no reason Smalltalk shouldn't be able to do what Common Lisp can, and do meta-programming around the message-intake process itself, while still allowing library authors to disable the meta-programming for consumers.
1
u/Thin-Eggshell Mar 19 '26
whoops.