26. Project model
26.1 Project-wide source configuration
CS-PROJECT-001. A project has one effective project ... end project declaration. Project.ds is the recommended filename, but semantics attach to the declaration rather than the filename. A second project declaration is a compile-time error identifying both sites.
project
root_namespace MyCompany.Reporting
import Global.System.Text.*
alias Json = Global.System.Text.Json.JsonSerializer
assembly attributes
Global.System.Reflection.AssemblyTitleAttribute("Reporting")
end attributes
end project
CS-PROJECT-002. Imports/aliases within the project declaration apply project-wide. Outside it they are file-local. Imports accumulate under ordinary ambiguity rules; conflicting aliases and root namespace values are errors. Configuration does not use last declaration wins.
CS-PROJECT-003. Project assembly attributes produce normal CLR assembly metadata using ordinary attribute argument/target validation. root_namespace supplies the default authored namespace root. Global. denotes the actual global CLR root and is unaffected by the project root.
26.2 Standard library and references
CS-PROJECT-004. The DirectSharp root namespace is automatically available by default. Its subnamespaces are not automatically imported. auto_import_directsharp false inside project disables the automatic root import and retains manual imports; omission or explicit true enables it. DirectSharp.Runtime names a small implementation-support package/assembly rather than the application-facing namespace for every convenience.
References determine available CLR types, libraries, features and wrapper engines. Mentioning a type or feature never causes an implicit package installation. Assembly availability is part of the compilation context; the language does not define a separate package manager.
26.3 Compiler context
CS-PROJECT-005. __compiler__ is a reserved compile-time context, not a runtime object. User code cannot declare, shadow, assign, replace or pass it by reference. Members have invariant meanings rather than context-dependent path conversion.
| Member | Meaning |
|---|---|
filename / filename_identifier |
Raw source stem / identifier-safe stem |
extension |
Extension without leading dot |
file_relative_path / file_absolute_path |
Source path relative to project root / absolute path |
dir_relative_path / dir_absolute_path |
Directory path relative to project root / absolute path |
directory_namespace |
Identifier-safe namespace form of relative directory hierarchy |
effective_namespace |
Namespace including the effective project root |
dir(n) / dir_identifier(n) |
Raw / identifier-safe ancestor segment; zero is current directory |
line / column |
One-based source location |
file_index |
Deterministic one-based compilation input position |
Identifier normalization is deterministic and locale-independent: preserve legal characters, replace illegal characters with _, prefix invalid initial characters and reserved-keyword segments, and diagnose remaining ambiguity. File paths never implicitly turn into dotted namespace text. Normalized names are not allowed to hide collisions.
Specification contents · Previous: 25. Preprocessing and includes · Next: 27. .NET interoperability