diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md index fab0e56..0569629 100644 --- a/docs/REFERENCE.md +++ b/docs/REFERENCE.md @@ -656,8 +656,12 @@ fn show() { } // Destructured binding, pulls specific names into the current scope. -const { Vec, Option } = import("collections"); -const { assert } = import("test"); +// Re-exports under `std` can be reached via chained access on the +// import expression — pick the names you need without binding the +// whole module. +const { Vec } = import("std").collections; +const { Option } = import("std").option; +const { assert } = import("test"); ``` The path is resolved relative to the file (`./collections.jam` or `std/string.jam`) or diff --git a/tests/unit/test_vec.jam b/tests/unit/test_vec.jam index a753482..efee0f7 100644 --- a/tests/unit/test_vec.jam +++ b/tests/unit/test_vec.jam @@ -1,7 +1,7 @@ // `Vec(T)` from std.collections; `Option(T)` from std.option. const { assert } = import("test"); -const { Vec } = import("std/collections"); -const { Option } = import("std/option"); +const { Vec } = import("std").collections; +const { Option } = import("std").option; const VecI32 = Vec(i32); const VecU8 = Vec(u8); diff --git a/tests/unit/test_vec_transitive_import.jam b/tests/unit/test_vec_transitive_import.jam index 92c6548..67caa75 100644 --- a/tests/unit/test_vec_transitive_import.jam +++ b/tests/unit/test_vec_transitive_import.jam @@ -4,7 +4,7 @@ // when walking the import graph, so Option is loaded transitively // without the user naming it anywhere in this file. const { assert } = import("test"); -const { Vec } = import("std/collections"); +const { Vec } = import("std").collections; tfn popWithoutExplicitOptionImport() { var v: Vec(i32) = Vec(i32).empty();