[plt-dev] some Racket proposals & implementation

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

On Apr  3, Sam Tobin-Hochstadt wrote:
> On Sat, Apr 3, 2010 at 10:01 PM, Eli Barzilay <eli at barzilay.org> wrote:
> >
> >> 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:
> I know.  I think these look *much* too similar:
> (define-struct (m x y))
> (define-struct m (x y))
> since they have *totally* different semantics.

Unless Jay added something that I didn't see, they don't have
different semantics -- the only difference is in the names that get
bound (`m' vs `make-m').  And from a user perspective, the similarity
to a function definition makes it natural to expect the first form to
bind `m'.

If anything, then this is what I think could be confusing (also not
because of different semantics):

  (define-struct (m n) (x))
  (define-struct (m x))

but even that kind of confusion can be rare -- it should be easy to
see what it is if there is more than one field, or with the name of
the struct that is usually very different from the name of a field.

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

Posted on the dev mailing list.