leah blogs

March 2005

03mar2005 · REBOL and Bluemoon

I’ve been thinking of building a syntactically-easy (not to say: trivial), but extremely flexible and extensible programming-language for some months already. I even wrote a sample interpreter for this language, Bluemoon.

Bluemoon is essentially a stack-based, concatenative language quite like postscript, but with reversed words. Instead of the Postscript to calculate, e.g. the BMI (weight / height^2, all code untested):

/weight 60 def   % kg
/height 185 def  % m
/square { dup mul }
weight height square div

you would write this in Bluemoon:

weight: 60  height: 185
square: { :n
  * n n
}
/ * height height weight

This has some beautiful side-effects on thinking in that language, it not only makes your brain unusable for ever doing Postscript (or Forth, Joy or Factor) again, but is actually quite intuitive.

Today, I somehow got the the REBOL page again, and had another look at it. This way probably the first time I looked at REBOL since 2001, or something. I was amazed how similar it was to Bluemoon (rather, the other way round):

weight: 60
height: 185
square: [n] [n * n]
weight / square height

The main difference is due to REBOL’s syntactic sugar for infix operators. And it doesn’t open the stack to you. (Last but not least, Bluemoon is much smaller in it’s design than REBOL, which has 13 core datatypes with unique syntax, even for stuff like “mail address” and “money”.)

Even more interesting are the similarities related to OO: both use prototypes and “contexts” (think of scope).

Unfortunately, REBOL never got popular. IMO, this is related to the lack of a free (as in freedom) reference implementation. It is also the reason why I won’t use it, and rather build my own stuff. Too bad, REBOL really seems to have some nice points (small, extremely portable, easy GUI AFAICS).

On the other hand, having now seen that lots of my ideas were already implemented by others, maybe I should strive for another language design… time will tell. :-)

NP: Dan Bern—Fly Away

Copyright © 2004–2022