docs: registry

This commit is contained in:
2026-02-09 18:26:03 -05:00
parent 2a028d95ec
commit 98b327103f
6 changed files with 72 additions and 27 deletions

View File

@@ -1,17 +1,18 @@
package registry
// A Expr is a lambda calculus expression. It can have any type of
// Expresentation, so long as that class is known to the registry it is handled
// An Expr is a type-erased lambda calculus expression. It can have any type of
// representation, so long as that type is known to the registry it is handled
// by.
type Expr interface {
// Repr returns the name of the underlying Expresentation. It is assumed if
// two expressions have the same Repr(), they have the same Expresentation.
// Repr returns the name of the underlying representation. Two expressions
// with the same Repr() are assumed to have the same representation type.
Repr() string
// The base expression data.
// Data returns the underlying expression data.
Data() any
}
// A baseExpr is the default implementation of Expr.
type baseExpr struct {
id string
data any
@@ -21,4 +22,5 @@ func (r baseExpr) Repr() string { return r.id }
func (r baseExpr) Data() any { return r.data }
// NewExpr creates an Expr with the given representation name and data.
func NewExpr(id string, data any) Expr { return baseExpr{id, data} }