guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [guile-user] Sandboxing?


From: Keisuke Nishida
Subject: Re: [guile-user] Sandboxing?
Date: Mon, 19 Mar 2001 05:25:27 -0500
User-agent: Wanderlust/2.4.0 (Rio) SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) Emacs/21.0.99 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Mon, 19 Mar 2001 02:13:06 +0000 (/etc/localtime),
Kyle Cronan wrote:
> 
> I read about how to create a safe module, and it seems to work great for
> my situation (web-based reporting language), but how do I 'enter' the
> module, so that all expressions are executed within it?  Also, I assume it
> is impossible to 'leave' the module once one has 'entered' it.

I guess `eval' does what you want:

  (use-modules (ice-9 safe))

  (eval '(+ 1 2) (safe-environment 5)) => 3

  (eval '(gc) (safe-environment 5))    ;; ERROR

You could write your own repl if you want:

  (use-modules (ice-9 safe))
  (define safe-module (make-safe-module))

  (define (safe-repl)
    (display "safe> ")
    (write (eval (read) safe-module))
    (newline)
    (safe-repl))

  (safe-repl)
  safe> (+ 1 2)
  3
  safe> (gc)
  ERROR

If you have any trouble with error handling or such,
I think you can feel free to ask it here.

Kei



reply via email to

[Prev in Thread] Current Thread [Next in Thread]