this post was submitted on 03 Aug 2023
27 points (100.0% liked)
Golang
2197 readers
1 users here now
This is a community dedicated to the go programming language.
Useful Links:
Rules:
- Posts must be relevant to Go
- No NSFW content
- No hate speech, bigotry, etc
- Try to keep discussions on topic
- No spam of tools/companies/advertisements
- It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Yeah, talking about
clear
. And "getting" is meant loosely, in the sense of "the state of the object after calling the function clear". Regardless of whether the object is modified or a copy returned, that's just weird behavior. Why notempty
andzero
to empty the container or reset objects in the container to their zero values respectively instead?I see what you're saying. Hmm. I do think that
clear
will be a nice addition. It does exactly what it says it'll do, "clear" out the object. In that same vein, I think your suggestions would both be solid alternatives.It sounds like
clear
is already on track to become a part of the language, but maybe you could be the first to put in a suggestion for azero
to accompany it in future releases?