Improve type system

This commit is contained in:
2024-01-26 01:52:46 +07:00
parent 692babe938
commit dfd21f0596
9 changed files with 141 additions and 98 deletions

26
core/values.go Normal file
View File

@@ -0,0 +1,26 @@
package elm
import (
"golang.org/x/exp/constraints"
)
type INumber interface {
constraints.Float | constraints.Integer
}
type ElmValueType int32
const (
NULLPTR ElmValueType = 0
NUMBER ElmValueType = 1
)
type ElmValue struct {
Type ElmValueType
Number int64
Null int64
}
func Number(val int64) ElmValue {
return ElmValue{Type: NUMBER, Number: val }
}