Hi everyone,

What's the expected behaviour for a function returning a value, of which
the type is contrary to the type defined in the function declaration? 

For example:

    var func:Function = function():int {
        return "This is not an int";
    }
    typeof(func()); // string

Is this expected behaviour? Here's some similar Actionscript 3 code:

    package {
        class ReturnTest {
            public function ReturnTest():void {
                returnInt();
            }
            private function returnInt():int {
                return "String instead";
            }
        }
    }

...which produces the following compile-time error:

    Implicit coercion of a value of type String to an unrelated type 
    int.


Regards,

--
Nathan de Vries

PS: Fantastic work with the Linux build of the reference implementation.
I'm working my way through the overview documentation, and will probably
have a poke at the SML when I'm feeling more game :).

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to