You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2019/02/12 08:12:22 UTC

[GitHub] Harbs edited a comment on issue #74: Assign to int or uint variable does not convert Number from floating point to integer

Harbs edited a comment on issue #74: Assign to int or uint variable does not convert Number from floating point to integer
URL: https://github.com/apache/royale-compiler/issues/74#issuecomment-462658868
 
 
   Regarding the Language.string discussion, I just discovered a difference between `val.toString()` and `"" + val`:
   `"" + val` implicitly calls `val.valueOf()` instead of `val.toString()`. If there is a difference in behavior between what you get from `valueOf()` and `toString()`, the two results will not be identical. I just ran into this with XML where the new code was causing the XML `valueOf` to be called and it was returning 0 instead of a space. I guess it's good we found the bug in XML, but it made me realize this difference.
   
   I'm not sure which behavior is more pure. I'm leaning towards saying that `valueOf` is better because `Language.string` is used for implicit coercions which the implementation of `valueOf` was designed for.
   
   I'm struggling to find a case where any of this should matter though... ;)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services