[plt-dev] some Racket proposals & implementation

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Apr 4 20:04:58 EDT 2010

On Apr 3, 2010, at 8:19 PM, Matthew Flatt wrote:

> I like
>   (define-struct (a x y) #:super b)
> much better than the current
>   (define-struct (a b) (x y))
> but I'm not sure that it's worth changing.


The issue I brought up in Boston was the 'heaviness' of the looks of our code, which to some extent is caused by long names. Going from (make-a 0 1) to (a 0 1) is a good weight loss. The above seems to call for trouble for a minor advantage. 



[[If we just used function headers without bodies as structure definitions, we'd at least lose more weight: 

   (define (a x y)) ;; defines a struct a of two fields, x and y 

But even that wouldn't do it. 

Similarly, we could drop a pair of parens from the current struct syntax to get to inheritance: 

   (define-struct a b (x y)) 

And we could make it all look like a class w/o methods and initialization expressions other than initial binding expressions: 

   (define a& (struct b& (init-filed x y)))

and we can claim Racket to be a pre-class-based language. The transition to methods would be syntactically straightforward from here. And I do this a lot. 

What am I getting at? I'd like to lose a lot of syntactic weight as we move into Racket and not gain any.]]



     




Posted on the dev mailing list.