[e-lang] Modifying safeScope?
Thomas Leonard
tal at it-innovation.soton.ac.uk
Mon Feb 22 06:19:21 PST 2010
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 at it-innovation.soton.ac.uk
http://www.it-innovation.soton.ac.uk
More information about the e-lang
mailing list