Amber Smalltalk


Amber Smalltalk, formerly named Jtalk, is an implementation of the Smalltalk-80 language that runs on the JavaScript runtime of a web browser. It is designed to enable client-side development using the Smalltalk programming language. The programming environment in Amber is named Helios.

Key features

Amber includes an integrated development environment with a class browser, Workspace, transcript, object inspector, and debugger. Amber is written in itself, including the compiler, and compiles into JavaScript, mapping one-to-one with the JavaScript equivalent. This one-to-one mapping with JavaScript differentiates Amber from other Smalltalk variants such as Pharo, Seaside, and Squeak. Developing Amber project requires Node.js to run the tooling; the deployed project only needs browser to run. Amber doesn't run slowly on a bytecode virtual machine due to its convenient mapping to JavaScript, which makes compiled code run fast.

History

Amber was originally created by Nicolas Petton in 2011. Amber was influenced by an earlier Smalltalk in browser project, named Clamato, created by Avi Bryant. Amber and Clamato both use parsing expression grammar libraries to parse Smalltalk source code. Amber uses the JavaScript based PEG.js library written by David Majda. Clamato uses PetitParser, a Smalltalk-based library written by Lukas Renggli. Clamato and Amber were both influenced by earlier work by Dan Ingalls in developing the Lively Kernel implementation of Morphic to run in web browsers via JavaScript.
Starting with version 0.12.0, Amber modules compile to asynchronous module definition. Starting with version 0.12.6, the development helper command-line interface tool is extracted to dedicated module, which can be installed from npm as @ambers/cli; and setting up the project and its JavaScript ecosystem is greatly simplified using this CLI tool by issuing amber init and answering a few questions. Since August 2018, project scaffolding of "amber init" is simplified, not using bower any more and only based off npm and whole project resides under npm organization @ambers. This makes setting Amber Smalltalk easier for people with little JavaScript experience.

Installing

Up-to-date instructions should be at https://lolg.it/amber/amber.
To install Amber, Git must be installed first, if it is not already. The following commands will install Amber:
  1. for macOS and Linux, needs the following two commands:
npm config set prefix=~/npm
export PATH="$PATH:$HOME/npm/bin" # add to.bash_profile or.bashrc
npm install -g grunt-cli grunt-init @ambers/cli
To create a new project, write:
  1. Create the empty project dir
mkdir example-project
cd example-project
  1. Create and initialize a new Amber project
amber init
"amber init" step will lead to some questions about the project. For most of them, a default answer can be set. The next step is to start the server:

amber serve

After that, typing http://localhost:4000 in the browser will get to the application. Most browsers will block Helios IDE pop-ups by default, so browser settings may need changing to allow the Helios IDE popup to appear.

Integrating external JavaScript libraries

Npm software can be used to access a vast array of JavaScript libraries. A library can be integrated by following only four steps:
  1. Install the library using npm.
  2. If 'local.amd.json' files doesn't exist for the npm package, create a 'libname.amd.json' file in the project root.
  3. Run 'grunt devel'.
  4. Add 'libname' to the application package's #imports:.

    Deployment

By running grunt deploy, the Amber project is packaged using RequireJS into just a few files, at the minimum just index.html and the.js.
You can host those statically as any other static web page.