Hi, i'm quite noobs on the language , and need language lawyers help,
The following:
fn function(types: *MyType) void {}
const MyType = struct {};
var types = *MyType;
pub fn main() void {
var t: MyType = .{};
function(&t);
}
because of the same name in the parameter (types) and the name in global scope. are the parameters associated to a global type definition ? this may not scale.
Newbie here aswell :). Zig doesn't allow shadowing at any level, that's why the compiler issues a "redefinition error".
As for the scaling problems: I don't think this causes any problems.
pub it won't leak over and therefore won't hide your definition.types is a type, while your parameter types is a value of said global types.Welcome, @frett27. Here are some places you can find other community members to discuss these things with: https://github.com/ziglang/zig/wiki/Community
"no shadowing" is not planned to be changed.
Most helpful comment
Welcome, @frett27. Here are some places you can find other community members to discuss these things with: https://github.com/ziglang/zig/wiki/Community
"no shadowing" is not planned to be changed.