Re: Modifying safeScope?
Thomas Leonard <tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Organization | IT Innovation |
| Message-ID | <[email protected]> |
On Mon, 2010-02-22 at 11:14 +0000, Thomas Leonard wrote:
> I found this a bit surprising... I guess safeScope can't be shared?
>
> # scope.emaker
> def someFunction() {
> def evalContext := safeScope.newContext(0)
> def tracelnNoun := safeScope.getScopeLayout().getNoun("traceln")
> tracelnNoun.initFinal(evalContext, def _(x) { traceln("Goodbye") } )
> }
>
> safeScope["traceln"]("Hello from traceln")
> someFunction()
> safeScope["traceln"]("Hello from traceln")
>
>
> $ rune scope.emaker
> > Hello from traceln
> ...
> > Goodbye
>
> Bug?
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)?
Also:
? { interface SturdyRef {} }
syntax error:
{ interface SturdyRef {} }
But:
? { interface Foo {} }
# value: Foo
--
Dr Thomas Leonard
IT Innovation Centre
2 Venture Road
Southampton
Hampshire SO16 7NP
Tel: +44 0 23 8076 0834
Fax: +44 0 23 8076 0833
mailto:tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]
http://www.it-innovation.soton.ac.uk