The last clox expression in the chapter the book instructs us to run is this:
!(5 - 4 > 3 * 2 == !nil)
This fails, however, with the error:
Operand must be a number
At this point in the chapter, I believe we have the following logic for the negate operation:
case OP_NEGATE:
if (!IS_NUMBER(peek(0))) {
runtimeError("Operand must be a number.");
return INTERPRET_RUNTIME_ERROR;
}
push(NUMBER_VAL(-AS_NUMBER(pop())));
break;
The last clox expression in the chapter the book instructs us to run is this:
This fails, however, with the error:
At this point in the chapter, I believe we have the following logic for the negate operation:
Thus, negating nil is not supported.