Code Review: InitAndScopes6

tfpt review “/shelveset:InitAndScopes6;REDMOND\tomat”

Outer-ring DLR changes (Hosting API implementation):

Any code compilation/execution without explicitly given scope should
eventually call SourceUnit.Compile overload that creates a new scope for
the execution, so that a) the creation of an implicit empty scope is
implemented on a single place and b) the language can adjust compilation
based upon whether the code is executed against a scope or not
(different overloads of LanguageContext.GetCompilerOptions are called).

Adds SourceUnit.Execute overload taking ErrorSink parameter to match
Compile overloads.

Ruby changes:

Enables sharing of Ruby top-level binding across multiple executions
against the same DLR Scope, which enables local variables in a console
implemented via DLR Hosting API.

Refactors control flow handling in rules:

  • Methods that build rules are of two kinds: BuildXxxNoFlow and
    BuildXxx, where the former produces a rule w/o control flow and
    optionally stores a control flow builder delegate on MetaObjectBuilder
    if CF handling is needed. The latter calls the former and if there has
    been a CF builder registered applies it on the resulting meta object.
    This allows to compose rules w/o CF and then apply CF handling once on
    the final result.

  • Fixes IO#open not to dynamically dispatch to “new”. The
    implementation requires the above rule composition.

Scope cleanup:

  • Renames GlobalScopeExtension to RubyGlobalScope.

  • Removes unnecessary dependencies on RubyScope where RubyContext is
    sufficient.

  • Replaces uses of Scope where RubyGlobalScope is more suitable.

  • Removes RubyContext.DefaultGlobalScope and adds Ruby.RequireFile
    taking a ScriptScope.

Replaces Booleans on RubyCompilerOptions with an enum.

Fixes method definition in module_eval or define_method.

Adds /py option to unit test driver, which enables tests dependent on
IronPython.

Tomas

Awesome! Ruby changes are good (other than a typo “bidning” in a
comment in HostingTests.cs :)).

From: Tomas M.
Sent: Tuesday, January 06, 2009 11:17 AM
To: IronRuby External Code R.; DLR Code Reviews
Cc: [email protected]
Subject: Code Review: InitAndScopes6

tfpt review “/shelveset:InitAndScopes6;REDMOND\tomat”

Outer-ring DLR changes (Hosting API implementation):

Any code compilation/execution without explicitly given scope should
eventually call SourceUnit.Compile overload that creates a new scope for
the execution, so that a) the creation of an implicit empty scope is
implemented on a single place and b) the language can adjust compilation
based upon whether the code is executed against a scope or not
(different overloads of LanguageContext.GetCompilerOptions are called).

Adds SourceUnit.Execute overload taking ErrorSink parameter to match
Compile overloads.

Ruby changes:

Enables sharing of Ruby top-level binding across multiple executions
against the same DLR Scope, which enables local variables in a console
implemented via DLR Hosting API.

Refactors control flow handling in rules:

  • Methods that build rules are of two kinds: BuildXxxNoFlow and
    BuildXxx, where the former produces a rule w/o control flow and
    optionally stores a control flow builder delegate on MetaObjectBuilder
    if CF handling is needed. The latter calls the former and if there has
    been a CF builder registered applies it on the resulting meta object.
    This allows to compose rules w/o CF and then apply CF handling once on
    the final result.

  • Fixes IO#open not to dynamically dispatch to “new”. The
    implementation requires the above rule composition.

Scope cleanup:

  • Renames GlobalScopeExtension to RubyGlobalScope.

  • Removes unnecessary dependencies on RubyScope where RubyContext is
    sufficient.

  • Replaces uses of Scope where RubyGlobalScope is more suitable.

  • Removes RubyContext.DefaultGlobalScope and adds Ruby.RequireFile
    taking a ScriptScope.

Replaces Booleans on RubyCompilerOptions with an enum.

Fixes method definition in module_eval or define_method.

Adds /py option to unit test driver, which enables tests dependent on
IronPython.

Tomas

DLR changes look good too.

From: Curt H.
Sent: Tuesday, January 06, 2009 1:41 PM
To: Tomas M.; IronRuby External Code R.; DLR Code Reviews
Cc: [email protected]
Subject: RE: Code Review: InitAndScopes6

Awesome! Ruby changes are good (other than a typo “bidning” in a
comment in HostingTests.cs :)).

From: Tomas M.
Sent: Tuesday, January 06, 2009 11:17 AM
To: IronRuby External Code R.; DLR Code Reviews
Cc: [email protected]
Subject: Code Review: InitAndScopes6

tfpt review “/shelveset:InitAndScopes6;REDMOND\tomat”

Outer-ring DLR changes (Hosting API implementation):

Any code compilation/execution without explicitly given scope should
eventually call SourceUnit.Compile overload that creates a new scope for
the execution, so that a) the creation of an implicit empty scope is
implemented on a single place and b) the language can adjust compilation
based upon whether the code is executed against a scope or not
(different overloads of LanguageContext.GetCompilerOptions are called).

Adds SourceUnit.Execute overload taking ErrorSink parameter to match
Compile overloads.

Ruby changes:

Enables sharing of Ruby top-level binding across multiple executions
against the same DLR Scope, which enables local variables in a console
implemented via DLR Hosting API.

Refactors control flow handling in rules:

  • Methods that build rules are of two kinds: BuildXxxNoFlow and
    BuildXxx, where the former produces a rule w/o control flow and
    optionally stores a control flow builder delegate on MetaObjectBuilder
    if CF handling is needed. The latter calls the former and if there has
    been a CF builder registered applies it on the resulting meta object.
    This allows to compose rules w/o CF and then apply CF handling once on
    the final result.

  • Fixes IO#open not to dynamically dispatch to “new”. The
    implementation requires the above rule composition.

Scope cleanup:

  • Renames GlobalScopeExtension to RubyGlobalScope.

  • Removes unnecessary dependencies on RubyScope where RubyContext is
    sufficient.

  • Replaces uses of Scope where RubyGlobalScope is more suitable.

  • Removes RubyContext.DefaultGlobalScope and adds Ruby.RequireFile
    taking a ScriptScope.

Replaces Booleans on RubyCompilerOptions with an enum.

Fixes method definition in module_eval or define_method.

Adds /py option to unit test driver, which enables tests dependent on
IronPython.

Tomas