package object // error encountered. This object is tracked through the evaluator and when // encountered stops evaluation of the program or body of a function. type Error struct { Message string } func (e Error) Bool() bool { return false } func (e Error) Type() Type { return ErrorType } func (e Error) Inspect() string { return "Error: " + e.Message } // Copy implements the Copyable interface func (e Error) Copy() Object { return Error{Message: e.Message} } func (e Error) Compare(other Object) int { if obj, ok := other.(Error); ok { if e.Message > obj.Message { return 1 } if e.Message == obj.Message { return 0 } return -1 } return -1 } func (e Error) Error() string { return e.Message } func (e Error) String() string { return e.Message }