Amber Smalltalk Explained

Amber Smalltalk
Logo Caption:An ancient flying insect caught in amber.
Author:Nicolas Petton
Developer:Amber Community
Latest Release Version:0.30.0
Latest Release Date:[1]
Programming Language:Smalltalk, JavaScript
Operating System:Cross-platform
Platform:Web browser
Language:English
Genre:Object-oriented programming language, IDE
License:MIT

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

Key features

Amber includes an integrated development environment (IDE) with a class browser, Workspace, transcript, object inspector, and debugger. Amber is written in itself (is self-hosting), including the compiler, and compiles into JavaScript, mapping one-to-one with the JavaScript equivalent.[3] This one-to-one mapping with JavaScript differentiates Amber from other Smalltalk variants such as Pharo, Seaside, and Squeak.[2] 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.[4] Amber was influenced by an earlier Smalltalk in browser project, named Clamato, created by Avi Bryant.[4] [5] [6] Amber and Clamato both use parsing expression grammar (PEG) libraries to parse Smalltalk source code. Amber uses the JavaScript based PEG.js library[7] [8] written by David Majda. Clamato uses PetitParser, a Smalltalk-based library written by Lukas Renggli.[4] 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.[4] [9]

Starting with version 0.12.0, Amber modules compile to asynchronous module definition (AMD).[10] Starting with version 0.12.6, the development helper command-line interface (CLI) tool is extracted to dedicated module, which can be installed from npm as @ambers/cli; and setting up the project and its JavaScript ecosystem (npm, grunt) is greatly simplified using this CLI tool by issuing amber init and answering a few questions.[11] Since August 2018, project scaffolding of "amber init" is simplified, not using bower any more and only based on npm and whole project resides under npm organization @ambers. This makes setting Amber Smalltalk easier for people with little JavaScript experience.[12]

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:[13]

  1. for macOS and Linux, needs the following two commands:

npm config set prefix=~/npmexport PATH="$PATH:$HOME/npm/bin" # add to .bash_profile or .bashrc

npm install -g grunt-cli grunt-init @ambers/cliTo create a new project, write:

  1. Create the empty project dir

mkdir example-projectcd 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:[13]

  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' (or 'grunt deploy' if ready to deploy an application).
  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, which can be hosted statically as any other static web page.

See also

Notes and References

  1. Web site: Release version 0.30.0 . 2021-03-25 . lolg.it.
  2. https://sites.google.com/a/world.st/worldofst/try/implementations Smalltalk Implementations
  3. Web site: Amber Smalltalk . Petton . Nicolas . amber-lang.net . 2016-01-30.
  4. News: Schuster . Werner . August 22, 2011 . Smalltalk IDEs Come to the Browser: Jtalk, tODE, Lively Kernel 2.0 . October 20, 2011.
  5. Web site: Clamato . (Clamato Smalltalk project website)
  6. Petton . Nicolas . August 2011 . Jtalk, the Smalltalk for Web developers . European Smalltalk User Group Conference (ESUG) . Edinburgh, Scotland, United Kingdom . https://web.archive.org/web/20120128093526/http://nicolas-petton.fr/presentations/esug2011/ . 2012-01-28. Slides.
  7. Web site: PEG.js: Parser Generator for JavaScript . Majda . David . 2010–2016 . PEG.js.org . David Majda . 13 November 2016 . 27 April 2011 . https://web.archive.org/web/20110427185009/http://pegjs.majda.cz/ . dead .
  8. Web site: Petton . Nicolas . 13 September 2011 . Bye, bye Jtalk... Hello Amber! . Google Groups . Google, Inc. . 13 November 2016 . ... we are now making a first release humbly numbered 0.9. We are also taking the opportunity to pick a slicker name for Jtalk - Amber!.
  9. News: Shuster . Werner . June 22, 2010 . Dan Ingalls on the History of Smalltalk and the Lively Kernel . October 26, 2011.
  10. Web site: amber-smalltalk/amber . GitHub . 2016-01-30.
  11. Web site: amber-smalltalk/amber . GitHub . 2016-01-30.
  12. Web site: Installing Amber . Petton . Nicolas . Amber-lang.net . 2016-01-30.
  13. Web site: A Gentle Introduction to Amber: Engaging in Smalltalk with Her, Reads Like English, and It’s Still Succinct!, "It’s alive! It’s alive!", The All-seeing Helios, Testing D3 . Eng . Richard . 2015-06-09 . Medium . 2016-02-07.