From: Mark Hubbart Date: 2004-05-04T05:32:46+09:00 Subject: Re: $SAFE = 3.5? On May 3, 2004, at 1:08 PM, gabriele renzi wrote: > il Tue, 4 May 2004 04:14:06 +0900, Guillaume Marcais > ha scritto:: > >> Is there anyway to have the same restriction that $SAFE=4 would give >> except the right to write to already opened IO? >> >> More generally, would it make sense to have a more flexible way to >> cherry pick what limitation to impose on a thread? Like: > > Would'nt make sense to remove $SAFE and introduce a SAFE module ? > This module could contain a getter/setter couple for every restriction > allowed by safe levels plus a convenient Safe.level=(anInteger) That's an interesting idea... perhaps even: Safe.level(2) do # unsafe code here end or Safe.flags(:no_filesystem, :no_redefine_core) do load "untrusted_code.rb" end I always thought that $SAFE was rather perlish, and hoped that it could eventually be gotten rid of. I think a Safe module would be a great way to get rid of the $SAFE global entirely (eventually). cheers, --Mark