fn foo(a: u8, b: usize, c: []const u8) void {} test "optional argument names" { foo(c: "Hi!", 0, 42); // -> foo(0, 42, "Hi!"); foo(a: 0, c: "bar", 10); // -> foo(0, 10, "bar"); }
Invalid argument names obviously cause a compile error.
To match the arguments, we simply look at the named arguments first, then match the rest in the same order they appear in the function definition.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4