From 5241863bbd8580331fd476b2525800e9a8dcc168 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Thu, 2 Mar 2006 22:16:14 +0000 Subject: [PATCH] Further testing clarified something, it's not as bad as I thought it was. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3908 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/README.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/as/com/threerings/README.txt b/src/as/com/threerings/README.txt index f910d3421..0cbbd1cde 100644 --- a/src/as/com/threerings/README.txt +++ b/src/as/com/threerings/README.txt @@ -177,13 +177,20 @@ ActionScript - Pitfall! This is perfectly legal: - var b :int = 3; - var b :String = "three"; // the first b is now lost, with no warning + var b :int = 3; + var b :int = 4; + + This will generate a compile warning: + var b :int = 3; + var b :String = "three"; + It generates the warning on assigning 3 to b, because it has looked + into the future and decided that b is a String, even though it's an + int on that line. And: var b :int = 3; - for (var ii:int = 0; ii < 3; ii++) { - var b :String = "three"; + for (var ii:int = 0; ii < b; ii++) { + var b :Number = "3.3"; } - trace(b); // prints "three" !! + trace(b); // prints "3.3", even though we've left the loop