jcburley / joker

Small Clojure interpreter and linter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Concrete Types Do Not Support Invocation of Embedded Interface Receivers

jcburley opened this issue · comments

E.g.:

user=> (use 'go.std.net)
nil
user=> (def d (Dial "tcp" "localhost:8000"))  ; assumes local port 8000 is accepting connections (e.g. HTTP server)
#'user/d
user=> (nil? (d 1))  ; else something went wrong
true
user=> (def c (d 0))
#'user/c
user=> (.SetKeepAlive c true)  ; invokes a method defined on the concrete type go.std.net/TCPConn
nil
user=> (.Close c)  ; invokes a receiver defined on another concrete type that implements interface/abstract type go.std.net/Conn
<file>:0:0: Eval error: No such member (field) GoObject[*net.TCPConn]/Close
user=>

Here, gostd is not noticing that TCPConn's struct embeds Conn, and thus does not generate info indicating that any methods (receivers) defined for interface type Conn should also be considered when looking up a method/receiver to invoke.

I've got the "backend" portion of this working already (did that yesterday); now I'm working on teaching gostd to discover those embedded interface types and generate the necessary data structures to build in with Joker.