Repository navigation
Replies: 2 comments 7 replies
|
Currently, this code let mut is_hex_output = false
let mut file_names: Slice<String> = []
for arg in os.Args[1:] {
if arg == "--hex" {
is_hex_output = true
continue
}
file_names.add(arg)
}
...will produce the warning I would expect a slice to be modified if entries are added, so I'd say, |
2 replies
|
@tmssngr Catching up to this thread:
|
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
IMHO Go lacks an important feature: making clear which functions are allowed to modify what. I would greatly appreciate it if the caller of a function/method would make it obvious which parameter might be modified by the callee. In my (Java) projects from time to time the last parameter is a "sink" callback to which the callee outputs some values. However, I can't express that in the language.
I suggest to use
mutas keyboard for the caller and function definition where a parameter might be modified. Otherwise the compiler should reject to compile:Though this would not make any difference in the resulting Go code, it would make it obvious while writing/reading the code which parameter can and which can't be modified by the called function. What do you think?
All reactions