GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - hyperpolymath/rattlescript: Python-syntax AffineScript — write Python-style code, get affine resource guarantees and typed WASM

BranchesTags
Open more actions menu

Latest commit

 

History

102 Commits
102 Commits

Folders and files

NameName
Last commit message
Last commit date
.devcontainer
.devcontainer
 
 
.github
.github
 
 
.machine_readable
.machine_readable
 
 
LICENSES
LICENSES
 
 
bin
bin
 
 
container
container
 
 
docs
docs
 
 
examples
examples
 
 
features
features
 
 
scripts
scripts
 
 
session
session
 
 
src
src
 
 
tests
tests
 
 
tools/invariant-path
tools/invariant-path
 
 
verification
verification
 
 
www/.well-known
www/.well-known
 
 
.affinescript-pin
.affinescript-pin
 
 
.editorconfig
.editorconfig
 
 
.envrc
.envrc
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.gitlab-ci.yml
.gitlab-ci.yml
 
 
.guix-channel
.guix-channel
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
.tool-versions
.tool-versions
 
 
0-AI-MANIFEST.a2ml
0-AI-MANIFEST.a2ml
 
 
ARCHITECTURE.adoc
ARCHITECTURE.adoc
 
 
AUDIT.adoc
AUDIT.adoc
 
 
CHANGELOG.adoc
CHANGELOG.adoc
 
 
CODE_OF_CONDUCT.adoc
CODE_OF_CONDUCT.adoc
 
 
Containerfile
Containerfile
 
 
EXPLAINME.adoc
EXPLAINME.adoc
 
 
GOVERNANCE.adoc
GOVERNANCE.adoc
 
 
Justfile
Justfile
 
 
LICENSE
LICENSE
 
 
MAINTAINERS
MAINTAINERS
 
 
MAINTAINERS.adoc
MAINTAINERS.adoc
 
 
PROOF-NEEDS.adoc
PROOF-NEEDS.adoc
 
 
PROOF-STATUS.adoc
PROOF-STATUS.adoc
 
 
QUICKSTART-DEV.adoc
QUICKSTART-DEV.adoc
 
 
QUICKSTART-MAINTAINER.adoc
QUICKSTART-MAINTAINER.adoc
 
 
QUICKSTART-USER.adoc
QUICKSTART-USER.adoc
 
 
READINESS.adoc
READINESS.adoc
 
 
README.adoc
README.adoc
 
 
ROADMAP.adoc
ROADMAP.adoc
 
 
SECURITY.adoc
SECURITY.adoc
 
 
TEMPLATE-STANDARDS-AUDIT.adoc
TEMPLATE-STANDARDS-AUDIT.adoc
 
 
TEST-NEEDS.adoc
TEST-NEEDS.adoc
 
 
TOPOLOGY.adoc
TOPOLOGY.adoc
 
 
contractile.just
contractile.just
 
 
coordination.k9
coordination.k9
 
 
eclexiaiser.toml
eclexiaiser.toml
 
 
justfile
justfile
 
 
llm-warmup-dev.adoc
llm-warmup-dev.adoc
 
 
llm-warmup-user.adoc
llm-warmup-user.adoc
 
 
mise.toml
mise.toml
 
 
selur-compose.toml
selur-compose.toml
 
 
setup.sh
setup.sh
 
 
stapeln.toml
stapeln.toml
 
 

Repository files navigation

RattleScript

License: MPL-2.0

Python-syntax AffineScript. Write code that looks like Python, get affine resource guarantees and typed-wasm output.

What it is

RattleScript is AffineScript with its rattle face pre-selected. If you write Python, you already know most of the syntax. The compiler checks that your resources (files, sockets, tokens, handles) are used exactly as many times as you declare — and proves it at compile time. No null pointer exceptions. No use-after-free. No silent data races. No GC overhead.

This repo is a brand surface only. The compiler, type checker, borrow checker, and codegen all live in affinescript. This repo carries:

  • Examples idiomatic to Python developers

  • Documentation aimed at the Python community

  • A rattle shim CLI that aliases affinescript --face rattle

  • Tutorial and migration guides for moving Python code into a strongly-typed, affine-typed, WASM-targeting world

Hello

examples/hello.affine:

# face: rattlescript

effect IO:
    fn println(s: String) -> ();

def main() -{IO}-> ():
    let greeting = "Hello, RattleScript!"
    println(greeting)

Same logical program, written in Python style. Compiles to the same canonical AST and the same typed-wasm output as every other face.

Install

opam install affinescript
git clone https://github.com/hyperpolymath/rattlescript
cd rattlescript

The affinescript binary does the work. The bin/rattle shim in this repo just defaults the --face flag.

Use

# Direct, via affinescript:
affinescript eval --face rattle examples/hello.affine
affinescript compile --face rattle examples/hello.affine -o hello.wasm

# Or via the rattle shim (same thing):
./bin/rattle eval examples/hello.affine
./bin/rattle compile examples/hello.affine -o hello.wasm

# Or via the justfile:
just run examples/hello.affine
just preview examples/hello.affine    # show the canonical lowering

Source files use the canonical .affine extension. The face is selected by the # face: rattlescript pragma on the first comment line, or by the --face rattle flag.

Different faces, same cube

RattleScript is one of six established faces over the AffineScript core:

  • AffineScript — the canonical face

  • RattleScript — Python-style (this repo)

  • JaffaScript — JavaScript / TypeScript-style

  • LucidScript — PureScript / Haskell-style

  • CafeScripto — CoffeeScript-style

  • PseudoScript — pseudocode-style

All six share the canonical .affine extension and lower to the same AST. Errors are reported in face-appropriate vocabulary.

Why RattleScript

Python is the most popular programming language and has the largest scientific / data / web community on Earth. It also has well-documented limits: dynamic typing, packaging hell, the GIL, performance ceiling for browser deployment, no ownership semantics. RattleScript is a Python-shaped on-ramp to a language that fixes those limits without making you learn an alien syntax first.

For a Python developer, the migration path looks like:

  1. Rename your .py files to .affine and add # face: rattlescript at the top.

  2. Type-annotate your function signatures (Python’s optional type hints become required, but you can usually copy them over).

  3. Add let to bare variable assignments.

  4. Replace import a.b with explicit imports.

  5. Compile to typed-wasm, ship to browsers / WASI runtimes / native via the same build.

Status

Alpha. The face transformer is implemented in affinescript/lib/python_face.ml. Known limitations are tracked in the affinescript faces README under "Known transformer gaps".

License

This project is licensed under the Mozilla Public License, v. 2.0. See the LICENSE file for details.

SPDX-License-Identifier: CC-BY-SA-4.0

About

Python-syntax AffineScript — write Python-style code, get affine resource guarantees and typed WASM

github.com/hyperpolymath/rattlescript

Topics

affine-typesaffinescripteffect-typedepistemic-computingepistemic-infrastructureequivalence-aware-computinghyperpolymathlanguage-designlinear-typesmulti-syntax-languageopen-sourceprogramming-languagepythonresearch-softwareresource-safe-wasmtype-systemstyped-provenanceveridical-computingwasmwebassembly

Resources

Readme
MPL-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.