What is "unit"?

# Shijun He (18 years ago)

I've read the presentation "The truth about JavaScript"developer.mozilla.org/presentations/eich-ajax-experience-2007

by Brendan, there are some code:

use unit acme.widgets "acme.com/widgets";

unit acme.widget { // program unit definition goes here ... }

What is the "unit" for? What's the relation of "unit" and "package"?

# Brendan Eich (18 years ago)

Great questions. The proposal has evolved a bit, so please forgive
the moving-target nature of the page available now at

proposals:program_units

(BTW, this is the new and as far as I know world-readable location of
the dokuwiki we've been using for proposals, discussion, and spec
prototyping. It's almost read-only now, since the reference
implementation, trac bug-ticket database, and real spec documents are
more the collective source of truth.)

There's more work to do, including rationalizing and minimizing
concepts including units and packages. A couple of notes:

A package is a named pair of namespaces (public and internal), some
rules for using those namespaces within the package body, and some
special forms for importing names from the package's public namespace.

Program units are compilation units, so unlike packages, which are
never "closed" and can be extended in a given trust domain, units
come to an end at the right curly brace.