namgk / ambienttalk

Automatically exported from code.google.com/p/ambienttalk
0 stars 0 forks source link

non-isolate extensions of isolates automatically turned into isolates #34

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Currently, in AmbientTalk, when a non-isolate object o extends an isolate 
object i, then o will be 
automatically turned into an isolate. This means it will not have access to its 
lexical scope, and 
will be passed by copy, even though it was not declared as an isolate. This 
makes sense, 
because:

is: o taggedAs: Isolate

returns true (o 'inherits' the type tag from its parent i)

However, we could also make it the responsibility of the programmer to 
explicitly tag children of 
isolates as isolates themselves. This also allows programmers to make 
non-isolate extensions of 
isolates. This change would also get rid of some ugly code in the constructor 
of NATObject, 
which explicitly checks for inheritance of isolates:

// if this object is tagged as at.types.Isolate, flag it as an isolate
// we cannot perform 'this.meta_isTypedAs(ISOLATE)' because this would trigger 
mirages too 
early
  if (isLocallyTaggedAs(NativeTypeTags._ISOLATE_)
  || dynamicParent.meta_isTaggedAs(NativeTypeTags._ISOLATE_).asNativeBoolean().javaValue) {
    setFlag(_IS_ISOLATE_FLAG_);
    // isolates can only have the global lexical root as their lexical scope
    lexicalParent_ = Evaluator.getGlobalLexicalScope();
}

Original issue reported on code.google.com by tvcut...@gmail.com on 21 Oct 2009 at 1:12