type Base struct {}
func (Base) Magic() { fmt.Print("base magic") }
func (self Base) MoreMagic() {
self.Magic()
self.Magic()
}
type Foo struct {
Base
}
func (Foo) Magic() { fmt.Print("foo magic") }
f := new(Foo)
prints "base magic base magic" and not "foo magic foo magic", which wouldfunc (self Base) MoreMagic() {
self.Magic()
self.Magic()
}
type Foo struct {
Base
}
func (Foo) Magic() { fmt.Print("foo magic") }
f := new(Foo)
give us more options. Brings the "Inner" keyword in the Beta programming
language to my mind, see Fig.2 on p.6 in this document:
http://fsl.cs.uiuc.edu/pubs/hills-aktemur-rosu-2005-tr.pdf
Wonder whether it could be applied here. So instead of
func (self Base) MoreMagic() {
self.Magic()
self.Magic()
}
self.Magic()
}
I coud say:
func (self Base) MoreMagic() {
inner.Magic()
self.Magic()
}
self.Magic()
}
and it would print "foo magic base magic". Would be really "magic", but
maybe it is not connected and I'm only dreaming ...
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.