[racket] ":" preferred to "define:"?

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Dec 22 13:22:55 EST 2010

40 minutes ago, Sam Tobin-Hochstadt wrote:
> On Wed, Dec 22, 2010 at 12:36 PM, Neil Van Dyke <neil at neilvandyke.org> wrote:
> > Why is ":" preferred to "define:", when usually you're just going to follow
> > the ":" form with a "define" form?
> >
> > The Typed Racket Reference says:
> >
> >> In most cases, use of ":" is preferred to use of "define:".
> Two reasons:
> 1. Adding `:' before the definition allows you not to change the
> existing untyped definition.  This is good for diffs, for example.

In my course I had a ton of definitions that were very formal but
still in comments:

  ;; foo : Number -> Number

and switching everything to TS was very easy with the `:' forms.

It goes the other way too -- it's much easier to move code back into
the untyped world by commenting out the `:' forms.

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

Posted on the users mailing list.