Say I want to provide a function foo
which gets an argument bar
, and also a totally unrelated function bar
. How do I do this?
pub fn foo(bar: i32) void {
_ = bar;
}
pub fn bar() void {
}
Gives:
shadow.zig:1:12: error: function parameter shadows declaration of 'bar'
pub fn foo(bar: i32) void {
^~~
shadow.zig:5:5: note: declared here
pub fn bar() void {
~~~~^~
My attempt to solve it with an alias (expectedly) fails as well:
pub fn foo(bar: i32) void {
- _ = bar;
+ const my_bar = bar;
+ _ = my_bar;
}
Any way around this? (Without having to rename the argument, which would have effects on created documentation, of course.)