
Potion - a little fast OO language by _why - arockwell
http://github.com/why/potion/tree/master
======
silentbicycle
Not to sidetrack things, but there is a bunch of cool stuff in the source for
Lua. Whether or not it gets used directly, it is going to have a _huge_
influence on the implementation of new languages.

It has a bunch of novel ideas* (e.g. the register-based VM, the table
optimizations) that have paid off big, it's very portable (due to being
written in strict ANSI C), and it has a surprisingly small code base. It's
pretty readable (<http://www.lua.org/source/5.1/>), full of examples of
simple-but-efficient garbage collectors, string handling optimizations, etc.
The designers have worked hard to keep it small and simple.

* See "The Implementation of Lua 5.0" (<http://www.tecgraf.puc-rio.br/~lhf/ftp/doc/jucs05.pdf>). It's 16 pages, and is a quick - but quite thought-provoking - read.

~~~
kragen
I agree that it has a bunch of novel ideas, but I wouldn't list the register-
based VM and table optimizations among them; register-based VMs go back to the
1950s, depending on how you want to count, and using different representations
for tables used as arrays and tables used as hashes (that's what you mean by
"table optimizations", right?) is pretty unsurprising. I'm not saying it isn't
a great engineering achievement; I never would have predicted that those
things would have been worth the cost in Lua's context, and they were,
brilliantly so.

I would instead list their one-pass-compiler implementation of flat closures
and their approach to continuations, and especially integrating continuations
with C code calling back into Lua.

I second the recommendation of the paper. I also think their paper on LPEG is
worth reading for anyone who is considering using regular expressions or yacc
or ANTLR for anything: <http://www.inf.puc-rio.br/~roberto/docs/peg.pdf>

~~~
silentbicycle
To my understanding, stack-based VMs are more common than register-based VMs,
and the Lua VM is noteworthy for being both well-implemented and small enough
to read. Then again, it looks like you're quite a bit ahead of me in reading
about VMs. I just found this in your "blog thing" yesterday:
[http://www.bentwookie.org/blog/kragen-
tol/2007-September/000...](http://www.bentwookie.org/blog/kragen-
tol/2007-September/000871.html) You've got a lot of good links. :)

By "table optimizations", I meant the way it behaves as both a dict and a
table, depending on how it is used, and how much they get out of using those
throughout the language. (I wrote the above in a hurry before catching the
bus, and knew I had missed better examples, but it came to mind from the
_Implementation_ paper.)

~~~
kragen
Yes, I agree that stack-based VMs are more common than register-based VMs, and
it was an unusual decision on the part of the Lua folks to choose a register-
based VM, particularly given their emphasis on implementation simplicity. And
it appears to have paid off, which is pretty cool!

I'm glad you've enjoyed the various links.

 _I meant the way it behaves as both a dict and a table_

You mean, a dict and an array?

I'm not sure I agree with their decision to unify those structures, but it
does seem not to have cost them much implementation complexity or performance.

~~~
silentbicycle
Oops. Dict and an array, yes.

Also, Lua had a stack-based VM until Lua 5.0.

------
LogicHoleFlaw
Man, _why knows how to just come out of nowhere and drop awesome stuff on us
all. This is really slick.

~~~
iamdave
Agreed, _why really makes me think of the days when hackers weren't doing
things with the hopes of getting a paycheck in the end, but more because they
had the know how, and they wanted to do it just to see if they could pull it
off.

It's an infectious virus that works rather brilliantly with the presentation,
and quality of work this guy puts together.

~~~
jcl
I wonder what he does for a living that he can pull all this stuff together in
his free time?

~~~
iamwil
It's been wondered before. <http://news.ycombinator.com/item?id=371897>

~~~
wingo
My god, that was a great article. Thanks for the link.

------
yan
Wow, the technical and artistic output by him is amazing. I'd love it if he
wrote a bit about how he operates, what his interests are and etc but I
somehow feel that is outside his character.

------
perezd
/me waits for web framework named: cauldron.

~~~
judofyr
and the Rack-port: Crack!

~~~
tlrobinson
Speaking of Rack ports... a JavaScript one I just started a couple days ago,
called Jack of course: <http://github.com/tlrobinson/jack>

------
ngvrnd
_Why is a very clever and subtle fellow. And to add insult to injury, he gets
things done! Huzzah for _Why!

~~~
MaysonL
Done! (And gets things smart).

------
tectonic
Who IS this guy and how is he so productive and awesome?

~~~
mhartl
I'm pretty sure _why is really like twelve guys just messing with our heads.

~~~
alnayyir
<http://en.wikipedia.org/wiki/Why_the_lucky_stiff> He's right there, dork. :P

~~~
mhartl
I know who _why is. I was being facetious.

------
bprater
What do you guys think of the language?

~~~
iamwil
It's interesting that there are no classes, and that there are only Objects,
where you just mix everything in.

As I understand it, javascript objects are like this, except you only add in
methods one at a time, instead of mixing in and out modules.

It doesn't look like there are inheritance trees. I'm not sure what you'd do
to prevent namespace clashes when mixing in different modules or if/how
modules share and work on object attribute data, but so far in Ruby, that
hasn't been too much of a problem.

~~~
nihilocrat
I think you'll have a "well, duh" reaction if you implement an OO system in
pure C. It is basically just a bunch of structs (data) with a bunch of
functions which take a struct pointer as their first argument. Mixins just let
you randomly add or remove these functions without any extra shenanigans,
which you can also easily do in our pure C OO system.

------
tpinto
ok, so _why did it again. from time to time, this guy comes from nowhere and
drops a little something of awesomeness. _why makes me feel sad and be ashamed
to even touch a computer keyboard :/ this guy rocks.

------
dangrover
When I grow up, I want to be like _why.

------
fauigerzigerk
Has anyone tried to run the ascii art piece from the README as a Potion
program?

------
michaelneale
Looks like a good experiment - is good to keep asm knowledge in circulation.

Also looks like it will do the fastest fib benchmark around !

------
bprater
Should we come together as a community and give out hacker awards?

Would it be fun?

Someone like _why is a real inspiration to me personally.

~~~
raygun
Me too!

------
vorador
who is _why ?

~~~
khafra
<http://poignantguide.net/> <http://en.wikipedia.org/wiki/Why_the_lucky_stiff>

A developer and Ruby advocate who's written one of the earlier and more
popular guides.

...you don't know how much restraint it took to avoid the Abbot and Costello
routine there.

------
hcayless
They should just get it over with and give him a MacArthur Genius Award....

