Amber Smalltalk

{{Infobox software

| name = Amber Smalltalk

| logo = Amber Smalltalk Logo.svg

| logo caption = An ancient flying insect caught in amber.

| author = Nicolas Petton

| developer = Amber Community

| released = {{Start date and age|2011|09|13}}

| latest release version = 0.30.0

| latest release date = {{Start date and age|2021|02|23}}{{cite web |url=https://lolg.it/amber/amber/commit/d0643e241c2ba97a9d8ab37a03bff29e04aef6c2 |title=Release version 0.30.0 |access-date=2021-03-25 |website=lolg.it}}

| programming language = Smalltalk, JavaScript

| operating system = Cross-platform

| platform = Web browser

| size =

| language = English

| genre = Object-oriented programming language, IDE

| license = MIT

| website = {{URL|www.amber-lang.net}}

| repo = {{URL|https://lolg.it/amber/amber}}

| standard =

| AsOf =

}}

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.[https://sites.google.com/a/world.st/worldofst/try/implementations Smalltalk Implementations] (brief comparative summaries describing Smalltalk dialects) 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.{{Cite web |title=Amber Smalltalk |url=http://amber-lang.net/ |last=Petton |first=Nicolas |website=amber-lang.net |access-date=2016-01-30}} 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.{{cite news |last=Schuster |first=Werner |date=August 22, 2011 |title=Smalltalk IDEs Come to the Browser: Jtalk, tODE, Lively Kernel 2.0 |url=http://www.infoq.com/news/2011/08/smalltalk-in-browser |access-date=October 20, 2011}} Amber was influenced by an earlier Smalltalk in browser project, named Clamato, created by Avi Bryant.{{cite web |title=Clamato |url=http://clamato.net/}} (Clamato Smalltalk project website)

{{cite conference |last=Petton |first=Nicolas |date=August 2011 |url=http://nicolas-petton.fr/presentations/esug2011/ |title=Jtalk, the Smalltalk for Web developers |conference=European Smalltalk User Group Conference (ESUG) |location=Edinburgh, Scotland, United Kingdom |archive-url=https://web.archive.org/web/20120128093526/http://nicolas-petton.fr/presentations/esug2011/ |archive-date=2012-01-28}} Slides. Amber and Clamato both use parsing expression grammar (PEG) libraries to parse Smalltalk source code. Amber uses the JavaScript based PEG.js library{{cite web |url=http://pegjs.majda.cz/ |title=PEG.js: Parser Generator for JavaScript |last=Majda |first=David |date=2010–2016 |website=PEG.js.org |publisher=David Majda |access-date=13 November 2016 |archive-date=27 April 2011 |archive-url=https://web.archive.org/web/20110427185009/http://pegjs.majda.cz/ |url-status=dead }}{{cite web |last=Petton |first=Nicolas |date=13 September 2011 |url=https://groups.google.com/d/topic/amber-lang/FsuX8geVXpk/discussion |title=Bye, bye Jtalk... Hello Amber! |website=Google Groups |publisher=Google, Inc. |access-date=13 November 2016 |quote=... 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!}}

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.{{cite news |last=Shuster |first=Werner |date=June 22, 2010 |url=http://www.infoq.com/interviews/ingalls-smalltalk |title=Dan Ingalls on the History of Smalltalk and the Lively Kernel |access-date=October 26, 2011}}

Starting with version 0.12.0, Amber modules compile to asynchronous module definition (AMD).{{Cite web |title=amber-smalltalk/amber |url=https://github.com/amber-smalltalk/amber/wiki/Migration-from-0.11-to-0.12 |website=GitHub |access-date=2016-01-30}} 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.{{Cite web |title=amber-smalltalk/amber |url=https://github.com/amber-smalltalk/amber |website=GitHub |access-date=2016-01-30}} 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.{{Cite web |title=Installing Amber |url=http://docs.amber-lang.net/installing-amber.html |last=Petton |first=Nicolas |website=Amber-lang.net |access-date=2016-01-30}}

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:{{Cite web |title=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 |url=https://medium.com/smalltalk-talk/a-gentle-introduction-to-amber-8c532631e9ab#.dcps4c7i2 |last=Eng |first=Richard |date=2015-06-09 |website=Medium |access-date=2016-02-07}}

  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' (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

{{Portal|Free and open-source software}}

References

{{Reflist}}