Files
cell/cell2.md
2025-11-29 12:40:59 -06:00

2.3 KiB

Cell

Cell is an actor system, intended to make it easy to parallelize programs.

Programs are written in cell, but cell also makes it trivial to interface with C code.

Packages

Each cell package has a .cell directory at its root. .ce files within this directory can be launched as cell actors, and .cm files can be imported with the 'use' statement.

When a file is imported, cell will search the following locations:

  • The current package
  • Imported packages
  • The cell standard library

Files leading with an underscore are not available to import from a package (but are OK for within a package)

For example, consider this project: prosperon/ prosperon/sprite.cm prosperon/render.cm prosperon/_help.cm prosperon/ui/ prosperon/ui/button.cm

sprite.cm can use(render); but an outside package must use(prosperon/render). sprite can use(help), but an outside package cannot use(prosperon/help).

Importing packages

Each package has a list of packages it depends on. They can use their own naming convention for them. Packages are imported from URLs, so, gitea.pockle.world/john/prosperon imports 'prosperon'; but, when importing, you can say, 'renderer = gitea.pockle.world/john/prosperon', and that means you can use(renderer/sprite), etc.

Modules

Modules have a .cm extension. Modules return a single value.

Programs

Programs have a .ce extension. Programs do not return a value.

The scripting language

Cell is basically javascript, but with some key modifications:

  • blobs instead of arraybuffers, which are written and read bit by bit
  • All equivalences are hard; there is only != and ==, and they do what !== and === do in javascript
  • There is no undefined, only null
  • 'var' acts like let, and 'def' acts like const; there is no let and const
  • logging is done with the global 'log' object; log.console outputs to console, log.error outputs an error, etc.
  • All numbers are dec64, and are all therefore exact; no floating point rounding errors.
  • All closures act like _ =>, and close over the 'this' variable
  • Arrays are distinct from objects
  • There is no 'delete' operator, just assign to null
  • There is no 'with'
  • There are no property descriptors, objects are more like records that can hold functions, numbers, anything.
  • stone() makes an object immutable, forever