Skip to content
This repository was archived by the owner on Jun 7, 2026. It is now read-only.

golang-design/go2generics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

119 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go2generics

Note

This repository is archived and no longer maintained.

It was a collection of experiments and demos exploring the Go 2 generics design (type parameters and type sets) before generics landed in the language. Generics shipped in Go 1.18 (March 2022), and the packages prototyped here now have official homes:

The content is kept for historical reference only. For up-to-date guidance, use the standard library and the official tutorials.

A chunk of demos for Go generics design (based on type parameters and type sets).

Standard Package

Package constraints

See the official implementation here.

Package slices

See the official implementation here.

Package maps

See the official implementation here.

Package container/set

This package is from the following discussions:

  • golang/go#47331 proposal: container/set: new package to provide a generic set type (discussion)

See a possible implementation here.

Others (under discussion)

Further Examples

See folders in this repository.

Known Issues

References

Here are some documents to get familiar with the spirit of generics:

Licnese

BSD-2-Clause

Copyright © 2020-2021 Changkun Ou

About

🧪 A chunk of experiments and demos about Go 2 generics design (type parameter & type set)

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages