Re: Modifying safeScope?
Thomas Leonard <[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Message-ID | <[email protected]> |
On 22 February 2010 14:35, Kevin Reid <[email protected]> wrote: > On Feb 22, 2010, at 9:19, Thomas Leonard wrote: > >> Another strange thing is that: >> >> ? interface SturdyRef {} >> java.lang.RuntimeException: Failed: can't redefine SturdyRef >> >> But I can override it using my loader. I think this is a good thing (I >> want to run my unit-tests in an environment with fake SturdyRef >> objects >> that don't really use the network), but I'm wondering if there's some >> security reason that means it shouldn't be redefined (auditors, etc)? > > This is from the “unshadowable names” auditors plan. The idea was that > a certain set of nouns (all those in the safeScope) *always* have the > values they do, so auditors can rely on their behavior. > > This system has been superseded by the “guard-based auditing” plan, > which allows auditors to instead get a certain amount of information > about what nouns *are* bound to, but E-on-Java has not been updated to > acknowledge this. So, should I remove the calls to requireShadowable? It's already possible to create a scope with whatever bindings you like, e.g. ? e`true`.eval(safeScope.with("true", false)) # value: false On the other hand, it would be nice to get an error by default if you try to redefine something because it's probably accidental ("def shadowing true := false" ?). I think that would be useful even for names that aren't in safeScope. Either way, it would also be nice to get an error in this case: ? def foo(x) { > def x := 1 > return x > } # value: <foo> ? foo(5) # value: 1 -- Dr Thomas Leonard GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA