I have the following code:
// eventloop.go
type Object interface {
ActivateSlot(name string, parameters vector.Vector);
}
// main.go
import loop "./eventloop"
// ...
const slotname = "printer"
type printer struct {
slot loop.Slot;
}
func (p *printer) Init() {
p.slot = loop.Slot{slotname, p}; // offending line
}
func (p *printer) ActivateSlot(name string, parameters vector.Vector) {
fmt.Println("Slot called: ", name);
}
When I try to compile, I get the following error:
jurily@jurily ~/workspace/go $ ./build.sh
main.go:23: cannot use p (type *printer) as type *eventloop.Object in field value
If I comment the offending line out, it compiles and runs fine. What's happening here? What am I missing?