BYOND Version:511
Operating System:Windows 8 64-bit
Web Browser:Chrome 71.0.3578.80
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary: Although null usually acts like 0 in an arithmetic expression, (null+0)/null causes a runtime error

Numbered Steps to Reproduce Problem: See code snippet

Code Snippet (if applicable) to Reproduce Problem:
0/null //0

0+null //0

(0+null)/null //Undefined operation: 0 / null

var/zero = 0/null //zero == 0

zero/null //Undefined operation: 0 / null

Expected Results:

The expression should be equal to 0.

Actual Results:

The expression causes a runtime error:

Undefined operation: 0 / null; proc name: dm eval (/proc/dm_eval); usr: (src); src: null; call stack:; dm eval(); world: New();

Does the problem occur:
Every time? Or how often? Every time.
In other games? N/A
In other user accounts? N/A
On other computers? Yes. Tested on two evaluators

When does the problem NOT occur? The problem always occurs.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit to download old versions for testing.)

Workarounds: Trivial to work around in a situation this may come up (check nulls, don't do this in the first place, etc)
Dividing a constant by null returns the constant. Dividing a non-const var or an expression that contains null by null throws this error. Both behaviors are different from 0, which throws a divide by zero runtime either way.
Have you checked this on 512? The behavior of constant expressions like this should be much more consistent.

I believe the correct behavior in 512 is that 0 / null alone will also produce a runtime error. It probably makes sense to try some basic type checking here and produce a compiler error for these situations, although honestly how often does that come up?
In response to Lummox JR
Yes, my apologies - this was actually checked on 512.1454, not 511.x as the post says.
Probably worth mentioning that >, <, >=, and <= have some odd behaviour when used to compare "" and null that changes with operand order too:

world.log << null < 0 // 0
world.log << 0 < null // 0
world.log << null < "" // 0
world.log << "" < null // runtime error: type mismatch: cannot compare "" to 0
In response to Persona E
Thanks. That's helpful to know.