Though there's no strict rule to name the instance when defining a method of the struct: type user struct { name string age int }
func(u *user) say() { // ... } Here we use `u`, but i still miss `this` feature, it does't mean i should use `this`, below is my idea: func (*user) say(){ // if want anonymous instance name?? fmt.Println(ts.name, this.age); // the default `this` name can be both `ts` and `this` or something i like to name } func (u *user) whatever() { // then i also could define one fmt.Println(u.name, u.age); // u overwrite using `ts` and `this` } // both code should work I'm not going to say i wanna change the go lang syntax, but i do prefer to add this to my golang version......so How? ( Or if it is complex, i leave it to the future version of me) -- 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.