[plt-dev] performance-oriented unsafe operations (v4.2.1.8)

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Sep 7 17:13:59 EDT 2009

On Sep  7, Faré wrote:
> Maybe it's better to keep the very same name as the safe operation,
> and let whoever imports it choose a different prefix. The immediate
> benefit is that switching from safe to unsafe becomes trivial, which
> is great for developing and testing in safe mode but delivering and
> running in unsafe mode.

That was one of the options to implementing this, but I think that it
is a little less convenient.  There is also an issue with some of the
operators that have no safe edquivalents -- for example, there is no
`fl*' function.

In any case, there is the `filtered-in' form for requiring modules
(from the `scheme/require' module) that can be used to achieve the
same effect:

  Welcome to MzScheme v4.2.1.8 [3m], Copyright (c) 2004-2009 PLT Scheme Inc.
  > (require scheme/require
             (filtered-in (lambda (s)
                            (let ([m (regexp-match #rx"^unsafe-(.*)$" s)])
                              (and m (cadr m))))
                          scheme/unsafe/ops))
  > (car 3)
  SIGSEGV fault on 0xf
  zsh: abort      mz

And, of course, going from here to defining an unsafe language like
you want is easy.

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


Posted on the dev mailing list.