Start here
Amber is Smalltalk for the web. You write classes and methods in Smalltalk. Amber compiles them to JavaScript, and the code runs in the browser or in Node.js. Amber is written in Amber, its compiler included.
You develop in Helios, a Smalltalk IDE that runs in the browser beside your application. When you save a method in Helios, the running page has it at once. When you commit the package, Helios writes the source to disk, as a .st file with its compiled .js beside it.
Amber uses JavaScript libraries as they are. A JavaScript object understands Smalltalk messages, and JavaScript code can call a Smalltalk object.
What you need
- Node.js 14 or newer, with npm. The tools run on it, and so does an Amber program outside the browser.
- A browser from 2020 or later: Chrome or Edge 80, Firefox 74, Safari 13.1, or anything newer.
- git, if you want it. The project generator takes your name and email from it, and a new project is ready for
git init.
The short way in
npm install -g grunt-cli grunt-init @ambers/cli
mkdir helloamber
cd helloamber
amber init
amber serve
Open http://localhost:4000/. The page shows a sample application, and a dialog offers you the two IDEs. Install Amber and make your first project takes you through these steps one by one.
Try Amber without installing
The front page of amber-lang.net has a button that opens the classic IDE in your browser. Prof Stef teaches Smalltalk syntax there in a few minutes, in a workspace on the page.
What this site covers
- Install Amber and make your first project: Node.js, the amber command, a project from amber init, the development server, and your first change in Helios.
- Your project’s files: What amber init made, file by file, and what each file is for.
- Working in Helios: The browser, the workspace, the inspector, the debugger and the test runner, the Action menu with its keys, and saving against committing.
- Building the page with Silk: Finding an element, putting text and elements into it, attributes, events and input, replacing and removing, and an object that puts itself on the page.
- Building the page with Web: Rendering into an element through a canvas, tags and attributes, events and input, replacing and removing, and a widget.
- Snippets, markup from the page: Pieces of HTML written in the page and filled in by code, the same markup for Silk and for Web.
- Keeping the page in step with MiniMVP: Presenters that show a part of the page from a block, refresh only what changed, hide what has nothing to show, and form a tree, with Silk or with Web.
- Build, test and deploy: The five grunt tasks of a project, what each writes, how the tests run under Node.js, and what you put on a server.
- Libraries: Where Amber’s libraries are, how a project takes one in, how it takes in a plain JavaScript library from npm, and how your own project becomes a library.
- Amber and JavaScript: How a message reaches a JavaScript object, which objects speak Smalltalk, blocks as functions, constructors, promises, errors, inline JavaScript, and calling Smalltalk from JavaScript.
- Upgrading a project: How a project made by an earlier Amber moves to 0.32.0, what to edit in the Gruntfile, and the steps older projects need first.
- The command line: The amber command and its six subcommands, the options of amber serve, the amberc compiler, and the two grunt tasks of the sdk with their options.
- Glossary: The words these pages use, from Amber’s own and from the JavaScript tools around it, each in a few lines with a pointer to the page that shows it.
- Questions and answers: Short answers to the questions that come up first, each with the page that goes deeper.
- TodoMVC with Silk: The TodoMVC application written with Silk, the model that every variant shares, and the view method by method, with what each point of the specification costs.
- TodoMVC with Silk and snippets: The TodoMVC application written with Silk and snippets, with the markup of each todo taken from the page, and what that changes in the view.
- TodoMVC with Silk and MiniMVP: The TodoMVC application written with Silk and MiniMVP, as a tree of presenters, one per part of the page, and what that changes in the view.
Where to ask
- The chat at chat.amber-lang.net, a Rocket.chat instance.
- The mailing list, the amber-lang Google group.
- Bugs in Amber, its compiler or the
ambercommand go to lolg.it/amber/amber/issues. Bugs in Helios go to lolg.it/amber/helios/issues. A mistake on this site goes to lolg.it/amber/amber-documentation/issues.
This site
These pages describe Amber 0.32.0, with Domite 0.10.3, Silk 0.7.3 and MiniMVP 0.3.0. The site lives in the amber-documentation repository on lolg.it, under the MIT License. Its README says how to build the site, and its writing-style.md says how a page is worded. A fix or a new page is welcome as a pull request.