Skip to content

Commit

Permalink
Export schema/dmt.TypeSystem.
Browse files Browse the repository at this point in the history
This is both necessary and sufficient to make it feasible for someone
to easily manipulate schema DMT data as IPLD, using the IPLD libraries.
That's a fairly obvious win.

(If I had my way about the language of golang, I'd be able to do this
while also keeping it strictly immutable.  That's... not how it works,
unfortunately.  But as it's normal in golang to have package-scoped
vars with semantic rules about no-touchy and no actual
compiler-enforced support, then, we might as well not deny ourselves
useful things by wishing for support for stricter rules that just
doen't exist.)
  • Loading branch information
warpfork committed Dec 14, 2022
1 parent e33bbd7 commit db9d8a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions schema/dmt/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var Type struct {

//go:generate go run -tags=schemadmtgen gen.go

var schemaTypeSystem schema.TypeSystem
var TypeSystem schema.TypeSystem

func init() {
var ts schema.TypeSystem
Expand Down Expand Up @@ -433,10 +433,10 @@ func init() {
panic("not happening")
}

schemaTypeSystem = ts
TypeSystem = ts

Type.Schema = bindnode.Prototype(
(*Schema)(nil),
schemaTypeSystem.TypeByName("Schema"),
TypeSystem.TypeByName("Schema"),
)
}

0 comments on commit db9d8a7

Please sign in to comment.