You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now we need a better way of handling min max constraints and their zero values.
As @iopred and @CarsonHoffman suggested, we should use *int and *float64, but I think I've found a better way of doing that.
While still holding on to the idea of using pointers we can create utility functions (which will be also useful in #1026 and #1052) for constructing an optional int and an optional float. They would look something like that:
funcNewOptionalInt(vint) *int {
return&v
}
What do you think?
The text was updated successfully, but these errors were encountered:
You could probably shorten the name from NewOptionalInt to just Int as well, or put it in a package called ptr like the AWS example, so the user can type something short and simple, like ptr.Int(n) (compare this to discordgo.NewOptionalInt(n)).
I mean yeah, but we shouldn't embed everything in discordgo, it was just a utility function, but making a package, I don't really know. Probably would be better just to leave it as it is, being a pointer, and remove the functions.
Right now we need a better way of handling min max constraints and their zero values.
As @iopred and @CarsonHoffman suggested, we should use
*int
and*float64
, but I think I've found a better way of doing that.While still holding on to the idea of using pointers we can create utility functions (which will be also useful in #1026 and #1052) for constructing an optional int and an optional float. They would look something like that:
What do you think?
The text was updated successfully, but these errors were encountered: