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

From: John Clements (clements at brinckerhoff.org)
Date: Tue Sep 28 13:38:34 EDT 2010

On Sep 28, 2010, at 10:09 AM, Eli Barzilay wrote:

> 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...)

I thought about this, but I really like the current setup, where the unsafe-ness must be indicated at the use of the function.  I think this is especially true of common primitives like "vector-length".  If I were debugging a piece of code, it would never occur to me that an ordinary-looking call to 'vector-length' might actually be unsafe.

>> 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))

This doesn't work for (require racket/unsafe/ops); that's why I wanted to add it.

> 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.

This frightens me, for the reasons I describe above.

> 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.

That sounds like what you described before, though perhaps I'm not understanding you.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4669 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20100928/774a3ed9/attachment.p7s>

Posted on the dev mailing list.