| CARVIEW |
Select Language
HTTP/2 301
server: nginx
date: Tue, 23 Dec 2025 19:15:44 GMT
content-type: text/html; charset=utf-8
content-length: 106
x-archive-orig-server: nginx/0.6.31
x-archive-orig-date: Wed, 18 Mar 2009 23:34:57 GMT
x-archive-orig-connection: close
x-archive-orig-status: 301 Moved Permanently
location: https://web.archive.org/web/20090318233459/https://github.com/why/potion/tree/master
x-archive-orig-x-runtime: 4ms
x-archive-orig-cache-control: no-cache
x-archive-orig-content-length: 106
cache-control: max-age=1800
accept-ranges: bytes
memento-datetime: Wed, 18 Mar 2009 23:34:59 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_8_20090318195256_crawl102-c/52_8_20090318233434_crawl101.arc.gz
server-timing: captures_list;dur=1.232400, exclusion.robots;dur=0.091658, exclusion.robots.policy;dur=0.070639, esindex;dur=0.017487, cdx.remote;dur=18.387604, LoadShardBlock;dur=259.404475, PetaboxLoader3.datanode;dur=135.760813, PetaboxLoader3.resolve;dur=112.360379, load_resource;dur=168.309629
x-app-server: wwwb-app220-dc8
x-ts: 301
x-tr: 498
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app220; path=/
cache-control: private
x-location: All
x-as: 14061
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Tue, 23 Dec 2025 19:15:45 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.6.31
x-archive-orig-date: Wed, 18 Mar 2009 23:34:59 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-x-runtime: 948ms
x-archive-orig-etag: "051e1fa77db3d777bcd61925fc155e77"
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-orig-content-length: 25892
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Wed, 18 Mar 2009 23:34:59 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_8_20090318195256_crawl102-c/52_8_20090318233434_crawl101.arc.gz
server-timing: captures_list;dur=0.811270, exclusion.robots;dur=0.027349, exclusion.robots.policy;dur=0.011819, esindex;dur=0.012554, cdx.remote;dur=5.535347, LoadShardBlock;dur=130.867240, PetaboxLoader3.datanode;dur=92.548375, PetaboxLoader3.resolve;dur=71.705743, load_resource;dur=59.157685
x-app-server: wwwb-app220-dc8
x-ts: 200
x-tr: 279
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-as: 14061
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
why's potion at master - GitHub
This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| Clone URL: |
git://github.com/why/potion.git
Give this clone URL to anyone.
git clone git://github.com/why/potion.git
|
potion /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Wed Jan 21 06:25:29 -0800 2009 | Adding core/config.h to gitignore Signed-off-b... [quag] |
| |
COPYING | Wed Jan 07 08:38:04 -0800 2009 | * INTERNALS: documenting the jit, the vm, the ... [why] |
| |
INSTALL | Thu Jan 08 01:19:34 -0800 2009 | * core: link functions completed. [why] |
| |
INTERNALS | Wed Jan 07 15:08:51 -0800 2009 | * INTERNALS: description of the jit's translat... [why] |
| |
Makefile | Sat Jan 24 01:58:04 -0800 2009 | * core/callcc.c: a start on call/cc. uses some... [why] |
| |
README | Mon Mar 16 15:05:35 -0700 2009 | * core/pn-gram.y: removing the data language f... [why] |
| |
core/ | Mon Mar 16 15:05:35 -0700 2009 | * core/pn-gram.y: removing the data language f... [why] |
| |
example/ | Mon Mar 16 15:05:35 -0700 2009 | * core/pn-gram.y: removing the data language f... [why] |
| |
test/ | Mon Mar 16 15:05:35 -0700 2009 | * core/pn-gram.y: removing the data language f... [why] |
| |
tools/ | Thu Jan 08 06:55:52 -0800 2009 | * core/compile.c: fix closures without argumen... [why] |
.ooo
'OOOo
~ p ooOOOo tion ~
.OOO
oO %% a little
Oo fast language.
'O
`
(o)
___/ /
/` \
/v^ ` ,
(...v/v^/
\../::/
\/::/
~ potion ~
Potion is an object- and mixin-oriented (traits)
language.
Its exciting points are:
* Just-in-time compilation to x86 and x86-64
machine code function pointers. This means
she's a speedy one. Who integrates very
well with C extensions.
The JIT is turned on by default and is
considered the primary mode of operation.
* Intermediate bytecode format and VM. Load
and dump code. Decent speed and cross-
architecture. Heavily based on Lua's VM.
* Bootstrapped "id" object model, based on
Ian Piumarta's soda languages. This means
everything in the language, including
object allocation and interpreter state
are part of the object model.
(See COPYING for citations.)
* Scoped mixins. Basically, you can modify
object behavior within a scope. So changes
to core classes can be localized.
++ INCOMPLETE ++
* Interpreter is thread-safe and reentrant.
I hope this will facilitate coroutines,
parallel interpreters and sandboxing.
* Small. Under 10kloc. Right now we're like
4,000 or something. Install sloccount
and run: make sloc.
* Reified AST and bytecode structures. This
is very important to me. By giving access
to the parser and compiler, it allows people
to target other platforms, write code analysis
tools and even fully bootstrapped VMs. I'm
not as concerned about the Potion VM being
fully bootstrapped, especially as it is tied
into the JIT so closely.
However, some warnings:
* Strings are immutable (like Lua) and byte
arrays are used for I/O buffers.
* No floating point support yet.
* No error handling. I'm wary of just tossing
in exceptions and feeling rather uninspired
on the matter. Let's hear from you.
* GC is reference counting. I know, I know,
but I put my eggs in other baskets. At
least it's quick.
~ a whiff of potion ~
add = (x, y): x + y.
add(2, 4) string print
Or,
"hello world" print
Or,
hello =
"(x): ('hello ', x) print." eval
hello ('world')
~ building and installing ~
$ make
Look inside the file called INSTALL for options.
~ how it transpired ~
This isn't supposed to happen!
I started playing with Lua's internals and reading
stuff by Ian Piumarta and Nicolas Cannasse. And I,
well... I don't know how this happened!
Turns out making a language is a lovely old time,
you should try it. If you keep it small, fit the
VM and the parser and the stdlib all into 10k
lines, then it's no sweat.
To be fair, I'd been tinkering with the parser
for years, though.
~ the potion pledge ~
EVERYTHING IS AN OBJECT.
However, OBJECTS AREN'T EVERYTHING.
~ items to understand ~
1. A traditional object is a tuple of data
and methods: (D, M).
D is kept in the object itself.
M is kept in classes.
2. In Potion, objects are just D.
3. Every object has an M.
4. But M can be altered, swapped,
added to, removed from, whatever.
5. Objects do not have classes.
The M is a mixin, a collection
of methods.
Example: all strings have a "length"
method. This method comes with Potion.
It's in the String mixin.
6. You can swap out mixins for the span
of a single source file.
Example: you could give all strings a
"backwards" method. But just for the
code inside your test.pn script.
7. You can re-mix for the span of a
single closure.
To sum up:
EVERYTHING IS AN OBJECT.
EVEN MIXINS ARE OBJECTS.
AND, OF COURSE, CLOSURES ARE OBJECTS.
However, OBJECTS AREN'T EVERYTHING.
THEY ARE USELESS WITHOUT MIXINS.
~ unique ideas (to be implemented) ~
Potion does have a few unique features
underway.
* It is two languages in one.
The language itself is objects and closures.
Number add = (x): self + x.
But it also includes a data language.
### EXAMPLE REMOVED
... the data format is being redesigned
The code and data languages can be interleaved
over and over again. In a way, I'm trying to find
a middle ground between s-expressions and stuff like
E4X. I like that s-expressions are a very light data
syntax, but I like that E4X clearly looks like data.
When s-expressions appear in Lisp code, they look
like code. I think it is nice to distinguish the two.
* Deeply nested blocks can be closed quickly.
I don't like significant whitespace, personally.
But I don't like end end end end.
say = (phrase):
10 times (i):
20 times (j):
phrase print
_say
The closing "_ say" ends the block saved to "say" var.
Normally, blocks are closed with a period. In this case
we'd need three periods, which looks strange.
say = ():
10 times:
20 times:
"Odelay!" print
...
If you prefer, you can give it some space. Or you can
use a variable name introduced by the block,
say = (phrase):
10 times (i):
20 times (j):
phrase print
_ phrase
say = (phrase):
10 times (i):
20 times (j):
phrase print
_ i
.
Maybe it all looks strange. I don't know. I'm just trying
things out, okay?
* Elimination of line noise.
I avoid @, #, $, %, {}.
Stick with ., |, (), [], =, !, ?. Easier on the eyes.
These are common punctuations in English.
* I try to defer to English when it comes to punctuation rules.
Period means "end". (In other langs it means "method call".)
Comma breaks up statements.
Space between messages gives a noun-verb feeling.
window open (width=400, height=500)
* Named block args.
(1, 2, 3) map (item=x, index=i): i display, x + 1.
~ license ~
See COPYING for legal information. It's an MIT license,
which lets you do anything you want with this. I'm hoping
that makes it very nice for folks who want to embed a little
Potion in their app!
This feature is coming soon. Sit tight!







