20 minutes ago, Sam Tobin-Hochstadt wrote: > On Sun, Sep 25, 2011 at 9:36 PM, Eli Barzilay <e...@barzilay.org> wrote: > > An hour and a half ago, Sam Tobin-Hochstadt wrote: > >> On Sun, Sep 25, 2011 at 8:14 PM, Eli Barzilay <e...@barzilay.org> wrote: > >> > IMO, a better approach for disabling contracts is to have the > >> > client decide whether it wants the contracted version or the plain > >> > one -- which is a rough mirror of how unsafe operations are done > >> > (with the choice being made by requiring one file or > >> > another). Then, there could be a facility that associates a safe > >> > identifier with an unsafe version, so you could write (unsafe foo) > >> > -- which will be the unsafe operation for builtins that have one, > >> > and in case of a contracted function it will be the uncontracted > >> > one. > >> > >> This wouldn't work for the Typed Racket use case, where I want to flip > >> one switch for contracts throughout the TR code base. > > > > (define-for-syntax contracts-on? #t) > > > > (define-syntax (switch stx) > > (syntax-case stx () > > [(_ id) (if contracts-on? #'id #'(unsafe id))])) > > But now I have to change all the places that use these identifiers.
Yes, you make it all go through that macro, and the problem is solved. > The "turn on and off internal contracts" and "give me unchecked > access to this library" use cases are genuinely different. Such a macro makes it possible to easily turn off all contracts. Meanwhile, you get to keep the contract information and use it for other purposes where it's still useful. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev