You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many methods, available to Go code via types embedded in interfaces and structs, are now also made available to Joker code. E.g. (.Close c) on a net.TCPConn connection c now works, even though TCPConn itself does not implement Close, because its struct embeds the (non-exported) net.conn type, which does implement Close. Note that gostd tries to avoid wrapping a method, available via an embed, that is explicitly implemented by the containing type. For example, text/template/parse.DotNode is a struct that embeds NodeType, for which the Type() method is defined; but, since DotNode implements its own Type(), that method, not NodeType's, is left as the wrapped type for e.g. (.Type d), where d is typeDotNode.
A value receiver for a reference (wrapped by a GoObject) can now be called without having to explicitly dereference the object. Some support for calling a pointer receiver for a value is now provided, but doesn't work in the straightforward case of a GoObject wrapping that value, as the Go runtime (specifically, the reflect package) does not always see such a value as capable of being addressable (reflect.CanAddr() fails).
Pointer types are named using *, instead of refTo, as * is a reasonably common character in Clojure symbols. However, as [ and ] are not valid (without escaping in some fashion), arrays/slices are still named using arrayOf, leading to some bodges such as arrayOf*Foo. It's unclear whether any elegant solution to this problem exists.
Preliminary support for func() types (taking no arguments and returning no value) is provided. However, it's purely experimental, and no attempt is made to ensure single-threading behavior with respect to other running Joker code. As the only test case currently defined invokes the function on a separate thread from the main thread passing the function, it's either happenstance, or the very limited use case of the Joker code that implements the function, that allows that test case to pass.
Substantial refactoring of gostd continues with this preliminary release, but much more is planned, some of which will likely be visible to Joker code calling the wrapped namespaces.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Many methods, available to Go code via types embedded in interfaces and structs, are now also made available to Joker code. E.g.
(.Close c)
on anet.TCPConn
connectionc
now works, even thoughTCPConn
itself does not implementClose
, because its struct embeds the (non-exported)net.conn
type, which does implementClose
. Note thatgostd
tries to avoid wrapping a method, available via an embed, that is explicitly implemented by the containing type. For example,text/template/parse.DotNode
is a struct that embedsNodeType
, for which theType()
method is defined; but, sinceDotNode
implements its ownType()
, that method, notNodeType
's, is left as the wrapped type for e.g.(.Type d)
, whered
is typeDotNode
.A value receiver for a reference (wrapped by a
GoObject
) can now be called without having to explicitly dereference the object. Some support for calling a pointer receiver for a value is now provided, but doesn't work in the straightforward case of aGoObject
wrapping that value, as the Go runtime (specifically, thereflect
package) does not always see such a value as capable of being addressable (reflect.CanAddr()
fails).Pointer types are named using
*
, instead ofrefTo
, as*
is a reasonably common character in Clojure symbols. However, as[
and]
are not valid (without escaping in some fashion), arrays/slices are still named usingarrayOf
, leading to some bodges such asarrayOf*Foo
. It's unclear whether any elegant solution to this problem exists.Preliminary support for
func()
types (taking no arguments and returning no value) is provided. However, it's purely experimental, and no attempt is made to ensure single-threading behavior with respect to other running Joker code. As the only test case currently defined invokes the function on a separate thread from the main thread passing the function, it's either happenstance, or the very limited use case of the Joker code that implements the function, that allows that test case to pass.Substantial refactoring of
gostd
continues with this preliminary release, but much more is planned, some of which will likely be visible to Joker code calling the wrapped namespaces.This discussion was created from the release Support methods defined on embedded types, rename 'refTo' to '*', etc..
Beta Was this translation helpful? Give feedback.
All reactions