[plt-dev] some Racket proposals & implementation

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Apr 3 22:01:01 EDT 2010

On Apr  3, Sam Tobin-Hochstadt wrote:
> On Sat, Apr 3, 2010 at 9:51 PM, Eli Barzilay <eli at barzilay.org> wrote:
> > On Apr  3, Matthew Flatt wrote:
> >> At Sat, 3 Apr 2010 18:30:57 -0600, Robby Findler wrote:
> >> > Does it make sense to give this revision to define-struct a different
> >> > name and keep the same old define-struct around from scheme/base?
> >>
> >> Lots of other forms and procedures have `struct' in the name, so if we
> >> just change `struct' to something else, we'd either have a mismatch or
> >> have many other changes.
> >>
> >> Or did you have a different kind of change in mind?
> >
> > How about this: the current `define-struct' and the one with the
> > lambda-look are (I think) easily distinguishable, so it could be a
> > single form that does the same thing it does now (and uses `make-foo'
> > for constructors) when using the existing syntax, and when you use the
> > new syntax you get the new thing.  Assuming that this can work, it
> > means that even the constructor name change is not happenning for
> > current code so there's no migration problem.
> 
> They are not anywhere close to easily-enough distinguishable that they
> should be the same form.  This is just asking for confusion.

I'm talking about the one that looks like a lambda:

  (syntax-case stx ()
    [(_ (name super) (field ...) . _)              'old]
    [(_ name (field ...) . _) (identifier? #'name) 'old]
    [_                                             'new])

or translating old-style to new-style, roughly like:

  (syntax-case stx ()
    [(_ (name super) (field ...) . options)
     #'(define-struct (name field ...) #:super super . options)]
    [(_ name (field ...) . options)
     (identifier? #'name)
     #'(define-struct (name field ...) . options)]
    [_ ...new structs...])

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the dev mailing list.