sample-code: Add example "module-hell.cl" demonstrating inter-module imports and path resolution

This commit is contained in:
John 2024-04-27 16:08:26 -05:00
parent 9566f098ac
commit 71745161c4

View File

@ -0,0 +1,17 @@
//! Demonstrates modules
fn main() {
use foo::bar::baz; // -> use super::baz::qux as baz: 10 -> fn baz::qux: 12
baz()
}
mod foo {
mod bar {
use super::baz::qux as baz; // -> fn qux: 14
}
mod baz {
fn qux() {
print("foo, bar, baz, qux")
}
}
}