[racket-dev] [plt] Push #21156: master branch updated

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Sep 28 13:09:00 EDT 2010

An hour ago, John Clements wrote:
> 
> On Sep 28, 2010, at 8:23 AM, Eli Barzilay wrote:
> 
> > Can we please not have this??  The whole point of having uniform names
> > is that you can use require/provide things easily so there's no need
> > for a library.
> 
> Sure, I don't feel strongly about it.  Done.

Thanks(!)

I should have clarified further -- what we have at the momemt is a
consisten use of an "unsafe" part in the path for potentially
segfaulting functionality.  So having some unsafe/safe thing doesn't
make much sense (and begs the question about undebugging some things
with unsafe/safe/unsafe).

In any case, I think that something that would have made you happier
is for the `unsafe/foo' libraries to provide the same name as the safe
ones.  This way you'd only need to toggle the `unsafe/' prefix on or
off.  (I'd like that change too, but we're probably deep enough in the
current setup to change that...)


> To be clear, my use case is this: I'm trying to debug a seg fault in
> a large library, with >500 uses of 'unsafe-' operators.  I want to
> see whether using the corresponding safe variants eliminates the
> crash.  The global search and replace is a bit of a pain; replacing
> racket/unsafe/ops with racket/unsafe/safe-ops is much easier.
> 
> Naturally, though, you can always roll your own as needed.

First, I think that what was suggested earlier should work -- changing
this:

  (require unsafe/foo)
  ->
  (require (prefix-in unsafe- foo))

But the more common use case (which I've done in a number of places)
is to use `foo' first, make sure the code runs and write a ton of
tests, then turn the require into one that *drops* the `unsafe-'
prefix.

A slightly different approach is in `racket/private/sort' -- define
names that are used throughout, and switch the definition from a safe
one to an unsafe one.

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


Posted on the dev mailing list.