--
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/86N_xtgcZqo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
--
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...@googlegroups.com.
I believe the transition from init() to main() should sufficient to do this syncing, but that's not said anywhere. Is it true?
All aggregate types--maps, slices, arrays, and even structs--are in
exactly the same position with regard to the memory spec. We don't
think the memory spec needs to say anything about slices, arrays, and
structs, because it is "obvious" that concurrent reads of those types
are OK.
I was saying that it is "obvious" with regard to slices, arrays, and structs.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/86N_xtgcZqo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
In my opinion, there aren't any sub-variables of a map. The spec says
clearly that there are sub-variables of slices, arrays, and structs.
It makes no such statement for maps. Here I'm obviously using the
word "variable" in the somewhat technical sense used in the spec,
where it basically something whose address can be taken.
A map is a single variable.
Yes, this is http://golang.org/issue/5803 .
On Fri, Mar 13, 2015 at 4:07 PM, Alan Donovan <adon...@google.com> wrote:
>
> we agree that read-only access to maps should be safe from multiple
> goroutines, but I can't see how it's valid to conclude that from the spec.
> You mention that the spec uses the word "variable" to mean something whose
> address can be taken; I think that's a good definition. But nowhere does
> the spec even remotely suggest that a map is a variable!
You could equally well say that the spec doesn't suggest that an int
is a variable. I think that http://golang.org/ref/spec#Variables has
to be read as saying that "var m map[k]v" give you a variable. When I
say "a map is a variable" I do of course loosely mean that a variable
of map type counts as a variable.
> - that m[k] and range operations on a map are reads of that variable, for
> the same purposes
> - and that m[k]=v and delete operations are writes.
Not necessary in my opinion. I just think people are letting their
understanding of the implementation color their assumptions about the
language. But I admit that I'm getting tired of this argument.
> - that a 'map' value may be safely represented by an unsafe.Pointer.
I don't think this should be stated by the spec at all. I don't think
ordinary code should assume this to be true.
An expression specifies the computation of a value by applying operators and functions to operands. (spec)
if the map contains an entry with key x, a[x] is the map value with key x and the type of a[x] is the value type of M