FAQ
the modified go with generics is here:
https://github.com/anlhord/go/tree/generics

the tests live here:
https://github.com/anlhord/untypedslice

next i'm planning to fix the todo's in tests.
i'm need assistance from someone who undestands src/cmd/gc

I need to add a Type to the node.
Need to generate the correct stuff for the reflect.c to work.
Also need to fix typecheck.c


On Monday, December 15, 2014 6:50:09 PM UTC+1, anl...@gmail.com wrote:

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

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 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 © 2022 Grokbase