ID:96517
 
Not a bug
BYOND Version:468
Operating System:Windows 7 Home Premium
Web Browser:Firefox 3.5.9
Applies to:Dream Maker
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:
Incrementing/decrementing a variable that does not contain a number results in whatever the variable previously referring to being disappeared and replacing it with a new number.

Code Snippet (if applicable) to Reproduce Problem:
mob
verb
test()
var/lol = list("cake")
src << ++lol

lol = "cake"
src << ++lol

lol = new /mob
src << ++lol


Expected Results:
For variables that are typecast, maybe a compile-time error. For non-typecast variables that don't contain numbers, a run-time error.

Actual Results:
Destroys whatever my variable was holding and replaces it with a number.

edit: Destroy isn't the proper word, I think. It just replaces the value of the variable. My object is, I assume, garbage collected.

edit: the above code prints:
1
1
1


Does the problem occur:
Every time? Or how often? Yes
In other games? Yes
In other user accounts? Yes
On other computers? Yes
A compile-time error is out of the question. A runtime error might be doable but there's a chance this could create unintended behavior in games that were built around the existing behavior. This behavior isn't wrong per se, because the operation of incrementing or decrementing a list or a string is undefined.