FAQ
I really like that idea. a map[string] could present its interface as a
map[string]bool while working as a map[string]struct{} internally. This way
you could check if a key is in the set without using the (value, ok) idiom
and still get the space savings of a map[string]struct{}.
On Friday, December 6, 2013 7:58:51 PM UTC+1, Michael Jones wrote:


On Fri, Dec 6, 2013 at 9:46 AM, Alberto García Hierro <
alb...@garciahierro.com <javascript:>> wrote:
1 - m["key"] = nil

I don't like this one much, but is the approach which requires the
smaller number of changes to the language. Obviously, trying to assign
anything but nil to a value-less map should generate an error.
Nothing wrong with this "shape." You could logically define an untyped as
evaluating to true for each key present, false for keys not present, and
then setting its value as true would make sense, just as setting it to
false would do a removal.

I like it. Call it an "anonymous set"
Michael T. Jones | Chief Technology Advocate | m...@google.com<javascript:>
+1 650-335-5765
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 10 of 21 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 6, '13 at 5:46p
activeDec 7, '13 at 9:05p
posts21
users12
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase