From 71745161c46670ac51cf34f5fb91c82b415899f0 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 27 Apr 2024 16:08:26 -0500 Subject: [PATCH] sample-code: Add example "module-hell.cl" demonstrating inter-module imports and path resolution --- sample-code/module_hell.cl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 sample-code/module_hell.cl diff --git a/sample-code/module_hell.cl b/sample-code/module_hell.cl new file mode 100644 index 0000000..130a2f6 --- /dev/null +++ b/sample-code/module_hell.cl @@ -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") + } + } +}