Closed venantius closed 8 years ago
I missed this until just now. Apologies.
On Thu, Jan 28, 2016 at 10:26 PM Ursa americanus kermodei < notifications@github.com> wrote:
Merged #5 https://github.com/venantius/glojure/pull/5.
— Reply to this email directly or view it on GitHub https://github.com/venantius/glojure/pull/5#event-530875128.
No worries. I think it was the right decision so I'm going to move forward with it.
@keithballinger, I'm curious what you think of this approach.
The problem I'm trying to solve for is the difference in inheritance rules between Go and Java. I need some sort of proxy for abstract classes. My approach here is to define an interface and then define static methods on that interface. Structs that are expected to satisfy the interface will have their own implementations for some of these methods, and in other cases should just point to the static method interface.
This is the bare minimum amount of work to show a proof of concept of this approach.
The downside to this approach is that it's very verbose. The upside is that I don't know of another way to solve the problem of, e.g.:
PersistentVector invokes abstract method A belonging to APersistentVector method A calls method B, which exists on PersistentVector but not on APersistentVector. Due to Go's type system, a memory access runtime panic occurs because the compiler cannot find a method B on APersistentVector.