Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pdcawley (485)

pdcawley
  (email not shown publicly)
http://www.bofh.org.uk/
AOL IM: pdcawley (Add Buddy, Send Message)

Journal of pdcawley (485)

Friday May 10, 2002
02:51 AM

Mmm....

Shiny ADSL Goodness. Now I can really have my home box cracked.

Wednesday May 01, 2002
04:10 AM

What time did I call that?

Hal an Tow!
Jolly Rumbelow
We were up
long before the day o!
To welcome in the summer
To welcome in the May o!
For Summer is a coming in
And Winter's gone away o!

So, at 5.30 this morning I was stood on top of the castle mound at Laxton with a bunch of morris dancers and other assorted nutters greeting the sunrise with a song.

And it was grand. Getting up to greet the sun on May morning is an old, old English tradition, and it's still done all over this island, at Padstow, Bampton, almost anywhere that has a morris side and probably hosts of other places that I don't know about.

There is something quite magical about watching the sun come up on a beautiful morning. The clouds lifted, the sun came up, we sang Hal An Tow and the morrismen danced a few dances, and an hour or so later, as the wind blew in a nasty looking front to hide the sun again, we scattered to our cars and headed off to work.

Sunday April 28, 2002
12:20 PM

He's only a little hoarse...

I just got back from the East Midlands Sacred Harp convention in sunny Kegworth. Ooh, but it was fun.

For those of you who don't know, The Sacred Harp is an American Hymnal, first published in 1844. These formed the core of a tradition of choral harmony singing which survived in the southern states, but which has recently started to spread again.

The tunes are just great. Real belters with surprising harmonies and glorious fuguing sections. The words are usually cracking too, full of the old fashioned blood and thunder and that fine Righteous obsession with death and everything being better on the other side.

It was my first time actually singing this stuff 'properly' -- I've heard and sung some of the songs before in folk sessions (Amazing Grace, Wondrous Love...), but never 'sung the shapes' or sung a part that was written by someone else. And it was great.

If you sing and you hear of a Sacred Harp singing happening near you, I can strongly recommend you go along and join in; there's something about singing loud and in harmony that just leaves you with big grin and a general happy feeling about life. Don't worry if you're not a believer, it certainly didn't stop me.

Thursday April 25, 2002
03:51 AM

To release, or not to release

So, I have this Perl Scheme interpreter.

On the plus side, it has:

  • Tail call optimization
  • Working define
  • Working lambda
  • Working if
  • Working set!
  • Working car/cdr
  • Working cons
  • Working quote
  • Working lexical scoping and closures

All of which means it's Turing Complete and could, in theory be used to implement the rest of scheme. (Must make readc and peekc available at the scheme level so you can implement a read/eval/print loop...)

On the downside it has:

  • No docs.
  • No tests.
  • No cond
  • No I/O
  • No scheme->parrot compiler (which is sort of the point of it...)

The no tests thing is faintly embarrassing given that I'm generally really keen on tests. Must poach a scheme test suite from somewhere. Until now let's pretend that this is a spike.

So, do I bundle it all up in a tarball and stick it on a website somewhere? Or do I just offer tarballs to anyone who asks with the usual 'patches welcome' caveats? Or do I keep it close and release it when it's a little tidier.

Thursday April 18, 2002
04:12 AM

Tail call `optimization' has arrived.

Yay! I've now got my Scheme Interpreter running on an abstract machine implemented in perl, doing tail optimization with partial continuations and stuff. It's, um, scary. And it's one more step closer to a parrot implementation (or a scheme to parrot compiler, whichever comes first).

But right now I'm not sure which scares me more. The code, the fact that I understand it, or the fact that I've not had to change any of my top level environment bindings to get it working. I 'just' subclassed my 'generic' Scheme::SchemeEvaluator and redid it as an abstract machine. I've had to add a couple of methods to my datatypes, but nothing dramatic...

It is, of course, dog slow. Maintaining your own call stacks etc and doing perl OO dispatch is never going to make for blinding speed. But hey, Parrot will solve that. He stated, blithely.

Tuesday April 16, 2002
07:26 AM

Oh dear...

So, I've got a semi working schemish dialect of lisp, and I'm rather pleased with it.

Meanwhile, at work, we're looking for a good way of configuring message dispatch rules (sort of like pipelines, but with potentially complex plumbing).

Hmm... I have the horrible feeling that this hobby code of mine is about to acquire some custom primitives and a couple or three special forms before emerging as our configuration little language.

03:30 AM

But Rocky! That trick never works!

This time for sure.

Okay, so the last post was a tad optimistic, but SchemeInterpreter has now acheived recursive lambda. Which is nice. But *my* is it slow. Ah well, it's only a stepping stone.

Sunday April 14, 2002
01:44 PM

SchemeInterpreter.pm achieves lambda

It can't officially be called Scheme (no tail call optimization, no macros (but they're a SMOP), no continuations (investigating Coro)) but hey, Turing completeness is always satisfying.

So, now I know that the basic design works it's time to re port it to Perl 6. Or maybe I should write a 'SchemeCompiler' class to replace SchemeEvaluator and generate parrot code.

Sorry, code is so not ready for a real release; there's a deeply embarrassing lack of tests or docs for starters, but I'm still chuffed.

Thursday April 11, 2002
05:47 AM

How I learned to stop worrying and love Perl 6

(Or... this Kool-aid tastes really good)

I wrote a large chunk of code in Perl 6; the beginnings of a Scheme interpreter (yes, it's got syntax errors, yes it has no comments, yes it is mind stretching if you don't grok OO). And it was a breeze. Most of my time working on this has been spent looking at a few docs on how the Scheme interpreter works and recasting that in Object Oriented form, and very little time has been spent wondering how to do it in Perl 6.

Now, the only catch is that I need to back port it to Perl 5 so I can have something runnable to test the basic design with. And it's painful, Perl 6 is just so much nicer; it just fits my brain better.

Thursday April 04, 2002
06:01 AM

Perl 6, making life easier for tool writers...

So, I was thinking about Smalltalk, and Perl 6, and another idea popped up.

Smalltalk has the concept of method categories, which are used to organize methods within the system browser. This means you can easily look at all the 'factory method's implemented by a class, or all the accessor methods or whatever. With large classes this can make a big difference to the class's understandibility when you look at it in the system browser.

So, consider this chunk of Perl6 code.

module Categories is Mixin {
  sub add_categories(@categories) {...}
 
  # Big, big guess/handwave, but it's not
  # essential to have. Just nice.
  sub category($name, &block) {
    &block.optree.walk_with -> $op {
      when OP::Sub {
        .attrib(category) //= $name;
      }
      return $op;
    }
  }
}
 
class SomeClass {
  use Categories;
 
  add_categories
    'accessor', 'setter',
     strangeCategory => "Category description";
 
  method new is category(factoryMethod) {...}
 
  method attrib is category(accessor) {...}
  method set_attrib is category(setter) {...}
 
  category strangeCategory {
    method foo {...}
    method bar {...}
  }
}

So, what's the benefit I hear you ask. Well, it moves documentation into the optree. I've realised from the work I've been doing on a refactoring browser that the more documentation you can get at 'programmatically', the easier it is to code useful tools.

For instance, given the category syntax above, it would become possible for a putative to class browser to query a class for its methods and categories, and it could then query those methods to find out which category to display the method in.

And, to my eyes at least, the source code reveals its intent more clearly.