FAQ
implementing generics
https://github.com/anlhord/go/commit/1eef19b08a793e8d8e83eb2114d9e77ef72bfc92

  so i've got this toy.go in my repo

https://github.com/anlhord/generic/blob/master/toy/toy.go

I get

./toy.go:95: cannot use &a (type **[]int) as type *generic.Container in
argument to Init
./toy.go:96: cannot use &a (type **[]int) as type *generic.Container in
argument to Destroy
./toy.go:97: cannot use &b (type **[]byte) as type *generic.Container in
argument to Init
./toy.go:98: cannot use &b (type **[]byte) as type *generic.Container in
argument to Destroy
./toy.go:99: cannot use &c (type **interface {}) as type *generic.Container
in argument to Init
./toy.go:100: cannot use &c (type **interface {}) as type
*generic.Container in argument to Destroy
./toy.go:106: cannot use &a (type **[]int) as type *generic.Container in
argument to At


now I want to break the type safety and to cast **[]int and **interface{}
to my *generic.Container type.

looked at ./cmd/gc/typecheck.c , seems fairly complex.

please give me some advice
thanks

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 7 | next ›
Discussion Overview
groupgolang-dev @
categoriesgo
postedDec 15, '14 at 6:05p
activeDec 19, '14 at 2:14a
posts7
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase