Source

magpie / README




                              _/Oo>
                             /(MM) 
                            A___/       m a g p i e
                    _______AV_h_h___________________________
                          AV
                         AV
                        AV


--- Warning --------------------------------------------------------------------

Magpie is currently undergoing a rebirth, so all of the docs and code here are
in a huge state of flux, incompletion, or are outdated. You're welcome to poke
around, but take it all with a huge grain of salt.

As I get closer to solidifying the new Magpie, I'll start cleaning out the old
stuff and documenting the new. Until then, tread carefully. That being said, the
Java stuff in here does work and does interesting stuff. Feel free to try it out
and let me know if you run into any problems.


--- About Magpie ---------------------------------------------------------------

Magpie is an interpreted programming language running on the JVM. Its raison
d'être is to try to combine the flexibility of dynamic languages with the safety
of static languages. It's a dynamic language that type-checks what you want it
to.

Syntactically, it's a bit like Io mixed with Ruby. Here's a little program that
helps you draw a dragon curve:

    var dragon(n, turn)
        if n > 0 then dragon(n - 1, "R") + turn + dragon(n - 1, "L")
        else ""
    end

    print(dragon(5))

And if we want to type-check it, we just change it to:

    var dragon(n Int, turn String)
        if n > 0 then dragon(n - 1, "R") + turn + dragon(n - 1, "L")
        else ""
    end

    var main(->)
        print(dragon(5))
    end

Both are perfectly valid Magpie programs and you can even mix together types and
untyped code. Get it? Good!