Assignment in IF Clause
PHP Code:
PHP Code:
Wrapping assignment in brackets doesn't fix this problem. Practical Usage: PHP Code:
|
Quote:
|
It doesn't set anything at all. It totally ignores the assignment. I thought it was to prevent those who do if ( player.chat = "command" ) stuff;, but... Just because they have no notion of what an assignment operator does, doesn't mean that we should follow suit and make it into a comparison operator when those who do know have, now, no way of using the assignment operator.
|
Quote:
|
GS2 automatically translates if (blah = thing) to if (blah == thing) to fix stupid people.
|
Quote:
is the same as temp.var = ( temp.var2 = ( temp.var3 = true ) ); temp.var = ( temp.var2 = true ); temp.var = ( true ); if ( temp.var )... Temp.var would return true. |
Quote:
|
Quote:
|
There are tons of scripts that the use wrong assignment operator, that's why it's better to keep this. It's not easy to debug either. Eventually it could display a warning when compiling the script and detecting an assignment operator inside an if/while/do statement. I would recommend to put the assignment into a separate line, that is better for readability anyway.
|
Could you have a server option that prevents GS1 backward compatibility.
I think leaving it as such is just encouraging bad standardization. Such as IE's CSS: The bad standardization impairs improvement of their CSS. |
Could be a server option yes
|
I would love for that to be a server option.
|
Quote:
I'd also be happy to see this, even though I'm not much into dev anymore. |
Quote:
ie: PHP Code:
|
All times are GMT +2. The time now is 02:08 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.