I am aware that usingnamespace
may be about to be axed from the language, but I was wondering, why it currently seems to be impossible to import declarations into the “top-level” (of the current file) namespace:
const std = @import("std");
const S = struct {
const foo = "foo";
};
const U = struct {
usingnamespace S;
};
const f1 = U.foo;
usingnamespace S;
const f2 = foo; // <-- error: use of undeclared identifier 'foo'
pub fn main() void {
std.debug.print("{s}\n", .{f1});
std.debug.print("{s}\n", .{f2});
}
Is this a bug or an undocumented limitation of the keyword?