Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile: minimal support of obj C generics #27729

Open
tadovas opened this issue Sep 18, 2018 · 1 comment
Open

x/mobile: minimal support of obj C generics #27729

tadovas opened this issue Sep 18, 2018 · 1 comment
Labels
mobile Android, iOS, and x/mobile
Milestone

Comments

@tadovas
Copy link

tadovas commented Sep 18, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.9.2 darwin/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/tadovas/work/go/openvpnv3-go-bindings"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_j/73ymsvw56v989xyfwn6q18_m0000gn/T/go-build533420179=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

binding ObjC method with accept or return generalized types like NSArray<NEPacket *>

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

What did you expect to see?

succesful bind

What did you see instead?

Method not found, which is expected.

This issue is more like feature request/discussion. Are there any plans to provide at least minimal support of generics in Obj C? There are some very nice iOS apis which expect NSArrays of concrete objects and it's sad, that we cannot bind them?
I would like to try to create a POC myself, so maybe someone else has done some investigation, have some thoughts etc?

As there is no generics concept in golang, so I see a biggest problem here is how to distinquish lets say NSArray<NEPacket *> from NSArray<NSDate *>

Current import which looks like this "Objc/Foundation/NSArray" generates golang interface NSArray with methods which are not typed (like Count) which is fine. So perhaps we can do something like
"ObjC/Foundation/NEPacket_NSArray" to generate distinct go interfaces with methods which accept or return NEPacket type parameters? I know it looks ugly, but I didn't find out any other options how to encode type name of array into interface as only to as part of interface name.

Any help, ideas, suggestions would be much appreciated

@gopherbot gopherbot added this to the Unreleased milestone Sep 18, 2018
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Sep 18, 2018
@tadovas tadovas changed the title x/mobile: x/mobile: minimal support of obj C generics Sep 18, 2018
@tadovas
Copy link
Author

tadovas commented Sep 18, 2018

And I guess we can put aside all those covariant/ contrvariant thingies at the moment. Plain and simple NSArray or any other example will be a huge start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

2 participants