On 03/12/2014 03:47, Marvin Humphrey wrote:
On Mon, Nov 17, 2014 at 1:12 PM, Marvin Humphrey <[email protected]> wrote:
* Clownfish abstract classes are mapped to Go interfaces.
* Clownfish concrete classes are mapped to Go struct pointers.
Shouldn't all (non-final, at least) Clownfish classes be mapped to Go
interfaces? Otherwise, I don't see how objects could be upcasted. This would
mean that for every class, there'd be an interface and a struct containing the
implementation. For the implementing structs, it should work to put a
cfish_Obj pointer in the Obj struct and the parent struct in the structs of
subclasses?
type Obj interface {
ToPtr() unsafe.Pointer
}
type ObjImpl struct {
ref *C.cfish_Obj
}
type Searcher interface {
Obj
Hits(...)
}
type SearcherImpl struct {
ObjImpl
}
type IndexSearcher interface {
Searcher
}
type IndexSearcherImpl struct {
SearcherImpl
}
Nick