[plt-dev] some Racket proposals & implementation

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sat Apr 3 06:31:58 EDT 2010

On Sat, Apr 3, 2010 at 12:21 AM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
> While grinding in FF13 tonight, I implemented most of this.

Awesome!

> I've attached three files. Put them in the same directory and you can
> run sstruct-tests.ss
>
> I allow default value expressions, keyword constructors, overriding
> names of accessors, mutators, constructors, and predicates. I support
> parent structs and match expanders.
>
> There's a bunch of places where more stuff could be allowed that I
> don't do yet. And I still have 8 test cases failing for those. Most of
> these and additional features should be easy to support.
>
> A few annoyances:
>
> First, I have to specify the parent of a struct with struct:id rather
> than 'id'. The problem is that I'd like 'id' to have three jobs:
>
> 1. match expander
> 2. constructor
> 3. struct type info
>
> Both 1 and 3 are static values so they'll conflict with each other.

The solution here is for one or both of these to be a struct property,
rather than a struct, so that one struct can be both.

I think that it's struct type info that needs to be the property,
since `match' depends on `define-struct', rather than the other way
around.  But probably they both should be.

Another possibility is that `match' could treat identifiers bound to
static struct info as pattern constructors, even without them being
match expanders.  This would probably be really easy to implement.

-- 
sam th
samth at ccs.neu.edu


Posted on the dev mailing list.