ID:2541076
 
BYOND Version:512
Operating System:Linux
Web Browser:Chrome 79.0.3945.130
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
Using the unary - operator on non-number builtin types and on datums/clients/etc. that do not define it does not throw a runtime, and instead just returns 0. This doesn't make much sense.

Numbered Steps to Reproduce Problem:
1. Write -var_that_is_not_a_number.

Code Snippet (if applicable) to Reproduce Problem:
var/var_that_is_not_a_number = "hi"
world.log << -var_that_is_not_a_number


Expected Results:
Runtime

Actual Results:
0

When does the problem NOT occur?
When the operator is used on a number or on a type that defines operator-().
Also, when you write 0 - thing instead of just -thing.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
I'm not aware of a time it hasn't been this way.

Workarounds:
Write 0 - thing instead of -thing, or just don't do this.
Note that it's not exceptionally difficult to write =- instead of -= by mistake, which results in strange bugs with non-obvious causes.