Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion doc/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,18 @@ are unnecessary at this stage. Typically, they are used to resolve relative
paths during import parsing. However, in our architecture, the prefix before
the first `::` in a `use` statement is always an dependency root path. Since all
dependency root paths are unique and strictly bound to specific paths, the resolver
can always unambiguously resolve the path without needing relative pointers.
can always unambiguously resolve the path without needing relative pointers.

# Architecture Note: Namespace Separation in SimplicityHL

SimplicityHL uses distinct namespaces for types and values. This allows the same identifier to refer to different things depending on where it appears in the code — the compiler determines the correct interpretation from syntactic context, with no risk of collision.

``` Rust
fn foo() -> bool { false }
type foo = bool;

fn main() {
let x: foo = false; // type namespace - type alias
assert!(foo()); // value namespace - function
}
```
1 change: 1 addition & 0 deletions src/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ pub struct DependencyGraph {
/// This serves as the exact inverse of the `lookup` map.
paths: Vec<CanonPath>,

// TODO: Consider to optimising this with `Vec` instead of `HashMap`
/// The Adjacency List: Defines the Directed acyclic Graph (DAG) of imports.
///
/// The Key (`usize`) is the ID of a "Parent" module (the file doing the importing).
Expand Down
Loading
Loading