Back to Roslyn

Imports in Scripts/Interactive

docs/compilers/Interactive Imports.md

11.0.1001.0 KB
Original Source

Imports in Scripts/Interactive

Guiding principles

Files includes by #load are each in a separate lexical scope. Declarations (including aliases) take precedence over usings (including using static) because they express intent.

Process

Steps (top to bottom)Binding UsingBinding Code#load
Look for declarations in the current submission/file (including aliases)Yes, excluding aliasesYes, in submissionYes, in file
Look for declarations in preceding submissions (including aliases), in orderYesYesNo
Look for members in the host object (if any)YesYesYes
Look for declarations in the global namespaceYesYesYes
Look in usings (except aliases) in the current submission/file and all preceding submissions (all at once, not looping)NoYes, in all submissionsYes, in file only
Look in the global imports of the current submission and all preceding submissions (all at once, not looping)NoYesYes