package object import ( "fmt" ) // BinaryOpError is an binary operation error usually resulting from mismatched types type BinaryOpError struct { left, right Object op string } func (e BinaryOpError) Error() string { return fmt.Sprintf("unsupported types for binary operation: %s %s %s", e.left.Type(), e.op, e.right.Type()) } // NewBinaryOpError returns a new BinaryOpError func NewBinaryOpError(left, right Object, op string) BinaryOpError { return BinaryOpError{left, right, op} }