Code Review: Loader9

tfpt review /shelveset:Loader9;REDMOND\tomat

DLR change:

Adds IsAbsolutePath to PlatformAdaptationLayer. On Windows the options
are:

  1. "foo\bar"
    
  2. "\foo\bar"
    
  3. "X:foo\bar"
    
  4. "X:\foo\bar"
    

Of which only the last one is absolute. 1) is relative to the current
directory, 2) and 3) are relative to the current drive.
One Unix all paths starting with “/” are absolute.

Ruby changes:

A new implementation of file loader in Ruby.

File loading works as follows:

Argument path is

  1.   CLR long assembly name or qualified type name
    
  •      Load .NET assembly or C# implemented Ruby library if the type 
    

of the library initializer is specified. The library initializer needs
to derive from LibraryInitializer class and is called to load the
library classes and modules.

  •      The path is matched against pattern (<type-name>,)? 
    

(, =)+, property
names are arbitrary identifiers and property values arbitrary strings
not containing ‘=’ or ‘,’. Exact CLR property names are not matched.

  1.   Absolute path
    

switch (extension):

  •     .rb -> load
    
  •     .dll
    
  • MRI: load dll

  • IR: not supported

  •     None
    
  • MRI: try load path + .rb, path + .dll

  • IR: try load path, path + extension for all registered extensions in
    runtime (.rb, .py, .js, …)

  •     If multiple files match exist an ambiguous match exception is 
    

thrown.

  1.   Relative path
    
  •     For each dir in LoadPaths: Apply (2) on dir combined with path
    

Notes:

  •      Require checks $" variable for loaded files and appends the 
    

name of the loaded file with extension to it on success.

  •      Load doesn't try to append extensions.
    

Adds Kernel#load_assembly(assembly, type) for loading assemblies and C#
implemented Ruby libraries.

Tomas

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs