Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.82k stars 821 forks source link

Why not using === instead of == #1013

Closed hardcoremore closed 6 years ago

hardcoremore commented 6 years ago

HI Daniel,

I know it is a nitpicking but why not using === equal signs here:

https://github.com/Gamua/Starling-Framework/blob/dbc1fffce90c33ff6c41783cdb86d2aff5342379/starling/src/starling/rendering/BatchToken.as#L67

All Best,

Caslav

PrimaryFeather commented 6 years ago

No specific reason, really, because it doesn't make any difference here. I know it's a good practice to use === instead of ==, but the Starling source code neglects that quite consistently. :wink:

joshtynjala commented 6 years ago

In my experience, the vast majority of ActionScript developers always use ==. Use of === is very uncommon. Using strict equality was never considered a best practice in same the way that it is for JavaScript developers.

JohnBlackburne commented 6 years ago

I think as the compiler knows what types the data is it won’t make any difference in performance or function, but would just be less readable for anyone not familiar with ===. I can’t think of any place I would use that now – it seems a holdover from when specifying data types was mostly optional. But in AS3 you normally specify all types, so your code knows the 'is it the same type' part of === at compile time.

PrimaryFeather commented 6 years ago

Thanks for the comments, guys! I'm glad you agree with me, and that we can leave this as it is.

Nevertheless, thanks for bringing it up, @hardcoremore! It's important to scrutinize such decisions regularly, and not simply accept things because "that's how we always did it". Cheers!