Update:
This code compiles here (all in one package):
type Object interface {
ActivateSlot(name string, parameters vector.Vector);
}
type Slot struct {
name string;
stuff Object;
}
const slotname = "printer"
type printer struct {
slot Slot;
}
func (p *printer) Init() {
p.slot = Slot{slotname, p};
}
func (p *printer) ActivateSlot(name string, parameters vector.Vector) {
fmt.Println("Slot called: ", name);
}
It seems that you are missing the fact that the * printer is of type Object, and you are trying to assign it to a field of type * Object, which is another type.
In most cases, you should write it, as indicated above, without pointers to interface types, but if you need to do this, you can do it like this:
type Slot struct {
name string;
stuff *Object;
}
func (p *printer) Init() {
var o Object = p;
p.slot = Slot{slotname, &o}; // offending line
}
, p - , p *Object.