Whitespace Matters

Mark Jason Dominus just released SuperPython 0.91, “a Perl source filter for the SuperPython language, allowing SuperPython code to be embedded into Perl programs”.
In terms of language, it goes way beyond python itself to give proper semantics to whitespace. For instance, here is the Hello World program written in SuperPython:

#!/usr/bin/perl
use SuperPython;



                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Ain’t it neat? Naturally, the result is

$ ./hello.spy
Hello, world.

just as would be expected.
If you want to try this program yourself you might be surprised to find out that copy+paste won’t work, but that’s a small price to pay in exchange or the benefits of the richness of syntax and expresiveness of the language, and anyway you may download the source code for hello.spy right here.
Mark is very optimist in contributing the new features of SuperPython back to python itself, and has kindly offered to work closely with the Python community to see this happen.
Congrats Mark, and keep up the good work!

[tags]code, perl, python, computer languages[/tags]

Posted in Code, General, Perl, Python, Tech
3 comments on “Whitespace Matters
  1. Wow! This is the greatest thing since sliced bread. Clearly the prelude to Web 3.0.

    I already ported part of the workflow system to SuperPython. Here’s the latest code:

    #!/usr/bin/perl
    use SuperPython;

    Ooops, forgot you can’t cut and paste. Will get back to you when I have a tgz available.

    Great link ;)

  2. Turns out this is not a new idea. There’s a (possibly) Turing complete language called Whitespace which actually works (not inside Perl though): http://compsoc.dur.ac.uk/whitespace/

  3. Mark Dominus says:

    SuperPython predates Whitespace by (exactly) two years.
    (SuperPython was released on 2001.)