[racket-dev] API naming conventions (Push #25466)

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Oct 16 18:48:10 EDT 2012

A few minutes ago, Matthias Felleisen wrote:
> 
> Eli, can you explain again -- perhaps in different words -- why
> define/match is a bad name? I understand that we have match-define
> and define/match now. While I agree that having two of these forms
> with remotely related functionality is possibly confusing, I don't
> see why match-define is really a better kind of name than
> define/match.

Well, I suggested `match-define' (before I realized that there was
already one) because it follows the same naming convention for the
rest of the library.


> If you are saying, that define/match is bad because it is too
> distinct from match-define I understand the name argument.

If that was the only issue, then I wouldn't have objected so strongly
to it -- but the fact that there *is* an existing `match-define', and
the fact that it does something different, mean that the match
interface becomes extremely confusing.  And that's not only for
newbies -- I can easily see myself not remembering which one of them
is doing which job.


A bit later, John Clements wrote:
> 
> Violent agreement; I'm saying that the *names* are the same (modulo
> a stylistic choice), not that the meanings are the same.

As for an attempt to explain why they're a bad combination, John
indeed put it nicely here.  We have two forms whose meaning is a
combination of a `define' and a `match', and hanging the difference on
the order of the two terms (and a `/' vs a `-') means that for human
readers, the difference is far from apparent.

And Matthias Felleisen added:
> 
> (I really dislike match-define. But it's historic so we're stuck.)

I completely agree -- I'd prefer a `define-match' or a `define/match',
in the same way that I'd also prefer a `let-match' etc.  (And I also
agree that the historic choice is an important restriction.)

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

Posted on the dev mailing list.