On Tue, 18 Apr 2017, at 01:04 PM, Tad Vizbaras wrote:

> 

> The argument could be that slices are read-only too. Just that
> "append" is special and it makes zero value slices useful.
> var a []int

> a[0] = 1 // Fails.

> // panic: runtime error: index out of range

> 

> I am just curious what is the reason behind not making zero maps more
> useful? Is it space?


A nitpick: slices are always read only. append creates a new slice, it
doesn't modify the original.


In that respect map and slice zero value behaviours are similar.



Ian

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to