ID:89697
 
Not a bug
BYOND Version:462
Operating System:Windows Vista Home Premium
Web Browser:Firefox 3.5.7
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:
When compiling DM code, any code containing one of the following gives a compile error when it shouldn't.
  • ].
  • ).
  • ]:
  • ):


Numbered Steps to Reproduce Problem:
1. Create a new Dream Maker environment.
2. Enter or copy-paste either code snippet from this bug report.
3. Try to compile and run the code.

Code Snippet (if applicable) to Reproduce Problem:
mob/verb/test()
var/client/myList[1]
myList[1] = client
src << myList[1].key

mob/proc/GetClient()
return client
mob/verb/test()
src << GetClient():key


Expected Results:
The code compiles and runs, and the 'test' verb tells you your key.

Actual Results:
The code does not compile.

Does the problem occur:
Every time? Or how often? Every time
In other games? Yes.
In other user accounts? Presumably.
On other computers? Presumably.

When does the problem NOT occur?

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.)

Workarounds:
Use the following code instead, which is ugly and uses an unnecessary variable:
    var/client/c = myList[1]
src << c.key

This isn't a bug, just a limitation in the language. Because DM is not strongly typed there's no way to follow up a list operator or proc call with the . operator, and while the : operator could do that in theory it isn't designed to. Changing the : operator's behavior to accommodate this would create an inconsistency, and would break old code that relies on certain parsing order for the ?: operator.