ID:104790
 
Not a bug
BYOND Version:479
Operating System:Windows 7 Pro
Web Browser:Chrome 8.0.552.200
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.
Numbered Steps to Reproduce Problem:
Compile code snippet
Code Snippet (if applicable) to Reproduce Problem:
mob/verb/Or2(A as num, B as num)
world<<A^B


Expected Results:
The result to be sent to world when the verb is used after it is compiled and ran.
Actual Results:
warning: ^: statement has no effect
Compiles but does not function correctly when ran.
Does the problem occur anywhere else?
Probably, but I'm to busy to test that right now.
Workarounds:
mob/verb/Or(A as num, B as num)
world<<(A^B)
Try putting A^B in parentheses. It might be some order of operations-ness.
Yes that is indeed a much better workaround... o.O
This is the case for all operators when outputting them to world. If you want to display an operation, you have to put it in parentheses.
No >.> I can assure you that all operators do not need parentheses when being outputted to world.
mob/verb/Or(A as num, B as num)
world<<A+B
world<<A-B
world<<A*B
world<<A/B
world<<A**B
world<<A++
world<<++A
world<<A--
world<<--A
world<<A>B
world<<A<B
world<<A<=B
world<<A>=B
world<<A<<B
//Only these need parenthesis
world<<(A>>B)//This one compiles but gives an error when you run it if you don't have parenthesis.
world<<(A^B)
world<<(A<>B)
world<<(A|B)
world<<(A||B)
world<<(A&B)
world<<(A&&B)
Chowder wrote:
No >.> I can assure you that all operators do not need parentheses when being outputted to world.
> mob/verb/Or(A as num, B as num)
> world<<A+B
> world<<A-B
> world<<A*B
> world<<A/B
> world<<A**B
> world<<A++
> world<<++A
> world<<A--
> world<<--A
> world<<A>B
> world<<A<B
> world<<A<=B
> world<<A>=B
> world<<A<<B
> //Only these need parenthesis
> world<<(A>>B)//This one compiles but gives an error when you run it if you don't have parenthesis.
> world<<(A^B)
> world<<(A<>B)
> world<<(A|B)
> world<<(A||B)
> world<<(A&B)
> world<<(A&&B)
>

Sorry, I knew what I meant, but I didn't actually say that. I meant all the binary/boolean operators don't work that way (except left shift seems to? I have no idea anymore..).
Everything that requires parentheses is below << in the operator precedence list.

Seems like DM considers <<(output) and <<(shift) as the same operator precedence wise.

You can see the list here: http://www.byond.com/ members/?command=reference&path=operator#comment_1

While it would seem to make sense that output would be the last operation performed, this is technically not a bug.
tenkuu wrote:
Everything that requires parentheses is below << in the operator precedence list.

Seems like DM considers <<(output) and <<(shift) as the same operator precedence wise.

You can see the list here: http://www.byond.com/ members/?command=reference&path=operator#comment_1

While it would seem to make sense that output would be the last operation performed, this is technically not a bug.

Well if it's not a bug I will make a feature request for it to separate output and shift in the operator precedence list, and I'll see how that goes over.
V-Why does it add this thing to the end of my post? x.x
</<>
tenkuu is correct regarding the operator order of operations, as well as his suggestion that << (output) should be evaluated last. Unfortunately, this is not so trivial to distinguish.