45 lines
1.5 KiB
Plaintext
45 lines
1.5 KiB
Plaintext
According to the ActionScript language reference, the star type:
|
|
|
|
____
|
|
Specifies that a property is untyped. Use of the asterisk symbol for a type annotation is equivalent to using no type annotation. Expressions that read from untyped properties are considered untyped expressions. Use of untyped expressions or properties is recommended in the following circumstances:
|
|
|
|
* When you want to defer type checking to runtime. You can use an untyped property or expression to circumvent compile-time type checking in strict mode. Note, however, that runtime type checking of assignment statements occurs whether you use strict mode or not.
|
|
* When you want to store the value undefined in a property. Unlike previous versions of ActionScript, the value undefined is not a member of the Object data type. You must use an untyped property to store the value undefined.
|
|
____
|
|
|
|
But deferring type checking to runtime can highly impact the robustness of the application because the compiler is unable to assist the developer.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,flex]
|
|
----
|
|
var obj:*; // Noncompliant
|
|
var foo:* = new Something(); // Noncompliant
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
[source,flex]
|
|
----
|
|
var obj:Something;
|
|
var foo:Something = new Something();
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|