On Friday, August 14, 2020 at 2:52:20 PM UTC-4 Joe Marty wrote:

>
>> If I know that a value exists, or am fine using the zero value (again, 
>> that's the majority of my personal use-cases for maps at least), having to 
>> use a statement just to discard the extra bool is annoying.
>>
>   
> Right, so this brings me back to a nice solution to both our use cases, 
> which would be to initialize the map as either having a default or not 
> having a default.  You don't have to check for failure, I don't have to 
> worry about forgetting to check for failure... right? :D
>
 
I know they are not here yet, but this is the kind of thing that generics 
were intended for. Once we have generics, you will be free to create a type 
safe map wrapper that gives you whatever behavior you want. IIRC, a richer 
set of containers is one of the main reasons people want generics in go. 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/eb65af00-7805-4bf5-87b1-d41c9f0e7e6bn%40googlegroups.com.

Reply via email to