style: rename repr to expr (#44)
## Description The `Repr` type name was unclear — it was intended to represent a lambda calculus expression, not a "representation." This PR renames `Repr` to `Expr` throughout the registry package for clarity. - Rename `Repr` interface to `Expr` and `baseRepr` struct to `baseExpr`. - Rename `repr.go` to `expr.go`. - Rename `ID()` method to `Repr()` to indicate the representation type. - Rename `NewRepr` constructor to `NewExpr`. - Update all usages in codec, conversion, engine, process, and registry files. - Add command aliases `conv` and `eng` for `convert` and `engine` subcommands. ## Benefits - The naming better reflects the domain: an `Expr` is an expression, and `Repr()` returns its representation kind. - Command aliases reduce typing for common subcommands. ## Checklist - [x] Code follows conventional commit format. - [x] Branch follows naming convention (`<type>/<description>`). Always use underscores. - [x] Tests pass (if applicable). - [x] Documentation updated (if applicable). Reviewed-on: #44 Co-authored-by: M.V. Hutz <git@maximhutz.me> Co-committed-by: M.V. Hutz <git@maximhutz.me>
This commit was merged in pull request #44.
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
type Engine interface {
|
||||
Load(Repr) (Process, error)
|
||||
Load(Expr) (Process, error)
|
||||
Name() string
|
||||
InType() string
|
||||
}
|
||||
@@ -22,10 +22,10 @@ func (e convertedEngine[T]) InType() string { return e.inType }
|
||||
|
||||
func (e convertedEngine[T]) Name() string { return e.name }
|
||||
|
||||
func (e convertedEngine[T]) Load(r Repr) (Process, error) {
|
||||
t, ok := r.Data().(T)
|
||||
func (e convertedEngine[T]) Load(expr Expr) (Process, error) {
|
||||
t, ok := expr.Data().(T)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("'ncorrent format '%s' for engine '%s'", r.ID(), e.inType)
|
||||
return nil, fmt.Errorf("'ncorrent format '%s' for engine '%s'", expr.Repr(), e.inType)
|
||||
}
|
||||
|
||||
process, err := e.engine(t)
|
||||
|
||||
Reference in New Issue
Block a user