You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type foo struct {
bar *Bar
}
func (f *foo) UseBar() {
f.bar.DoSomething()
}
This results in double dereferencing - once to get the pointer bar and another within DoSomething() to access the fields of Bar.
Idiomatic Go would use bar Bar and then call pointer methods through the foo pointer. In GooseLang we already support constructing the pointer using a location offset, but goose doesn't emit code that takes advantage of this. See failing_testFooBarMutation for an example of what we'd like to support.
Implementing this probably requires some refactoring of the address-of code, to factor out all the code that computes pointers.
The text was updated successfully, but these errors were encountered:
Right now we write code like
This results in double dereferencing - once to get the pointer
bar
and another withinDoSomething()
to access the fields ofBar
.Idiomatic Go would use
bar Bar
and then call pointer methods through thefoo
pointer. In GooseLang we already support constructing the pointer using a location offset, but goose doesn't emit code that takes advantage of this. Seefailing_testFooBarMutation
for an example of what we'd like to support.Implementing this probably requires some refactoring of the address-of code, to factor out all the code that computes pointers.
The text was updated successfully, but these errors were encountered: