You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2021/12/27 11:12:30 UTC

[royale-docs] branch master updated: Added info about equality

This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/royale-docs.git


The following commit(s) were added to refs/heads/master by this push:
     new c1ef8fb  Added info about equality
c1ef8fb is described below

commit c1ef8fb462e77369d518e00a55489ddfd8a8af1d
Author: Harbs <ha...@in-tools.com>
AuthorDate: Mon Dec 27 13:12:20 2021 +0200

    Added info about equality
---
 features/as3/actionscript-vs-typescript.md | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/features/as3/actionscript-vs-typescript.md b/features/as3/actionscript-vs-typescript.md
index 00ddaf7..1be408c 100644
--- a/features/as3/actionscript-vs-typescript.md
+++ b/features/as3/actionscript-vs-typescript.md
@@ -34,7 +34,11 @@ Royale's goals are different. It provides a complete development environment. Th
 While Royale give very high priority to performance, our philosophy is that besides compile time type safety, runtime type safety is important too. By providing certain runtime guarantees, a certain class of Javascript bugs disappear. (More details to follow...)
 
 ## Testing equality
-Details about strict equality...
+In Javascript, strict equality is recommended (i.e. `===`) instead of "normal" equality (i.e. `==`). That's because Javascript automatically does a type coercion before comparing equality and can cause unexpected results.
+
+Royale generally does not have these problems and bugs caused by using `==` is extremely rare. That's because types are enforced at compile time and uncertain values are automatically coerced when assigning the values. Normal equality has advantages and can be used for automatically evaluating certain types (such as `XML`). Therefore the general recommendation in ActionScript and Royale is to use `==` instead of `===`.
+
+The exception to this rule is if you are using untyped variables (i.e. `*`) and need to test for `undefined` to the exclusion of `null`. In that case you need `foo.baz === undefined`.
 
 ## Strings and Numbers
 Differences there