)
>>
>> Does it means the map values can be changed inside the function?
>>
>> If yes, what's the proper way to declare it so as to make sure the values
>> cannot be changed inside the function?
>>
>> Thanks, and sorry if the question seems too dumb.
>>
y to declare it so as to make sure the values
> cannot be changed inside the function?
>
> Thanks, and sorry if the question seems too dumb.
>
>
> ---------- Forwarded message --
> From: Valentin Deleplace @gmail.com
> Date: Fri, Jun 24, 2016 at 2:11 AM
> Subject: Re
No penalty - a map is already a pointer.
--
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:/
On Thu, Jun 23, 2016 at 6:54 PM, Val wrote:
Even in OO style (e.g. java), you would not be able to write
> Set s = null;
> s.init( list(1,2,3) );
>
> This is (more or less) the same problem with value receiver... the
> "constructor-like" idiom in go is a function NewSet, not a method :
https:
line 17 can become:
*s = make(set, len(slice))
--
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, v
wow, that way. Thanks!
On Thu, Jun 23, 2016 at 6:28 PM, Val wrote:
> https://play.golang.org/p/DTtGs3FiwZ
>
> --
> 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/top
https://play.golang.org/p/DTtGs3FiwZ
--
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://gro
I did tried to change to,
func (s *set) Init(slice []string) {
but that gave loads of errors that I can't fix, hence the question.
On Thu, Jun 23, 2016 at 6:19 PM, Val wrote:
> Assigning a value to the receiver will only affect local variable.
> Try pointer receiver.
>
> --
> You received thi