All Projects → clipperhouse → typewriter

clipperhouse / typewriter

Licence: other
The package underlying gen: type-driven code generation for Go

Programming Languages

go
31211 projects - #10 most used programming language

##What’s this?

Typewriter is a package to enable pluggable, type-driven codegen for Go. The envisioned use case is for generics-like functionality. This package forms the underpinning of gen.

Usage is analogous to how codecs work with Go’s image package, or database drivers in the sql package.

import (
    // main package
	“github.com/clipperhouse/typewriter”
	
	// any number of typewriters 
	_ “github.com/clipperhouse/set”
	_ “github.com/clipperhouse/linkedlist”
)

func main() {
	app, err := typewriter.NewApp(”+gen”)
	if err != nil {
		panic(err)
	}

	app.WriteAll()
}

Individual typewriters register themselves to the “parent” package via their init() functions. Have a look at one of the above typewriters to get an idea.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].