ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
**从Haxe 3.1.0以后** > **Since Haxe 3.1.0** 通过下面的语法,可以使用编译时类型检查: > It is possible to employ compile-time type checks using the following syntax: ~~~ (expr : type) ~~~ 括号是强制性的。不想安全转换(第5.23.2),这个结构没有运行时的影响。它有两个编译时的影响: > The parentheses are mandatory. Unlike safe casts (5.23.2) this construct has no run-time impact. It has two compile-time implications: * 从上至下的推断(第3.6.1节)用于类型化 expr 为 type 类型 * 结果的类型化的表达式统一(第3.5节)为type 类型 > * Top-down inference (3.6.1) is used to type expr with type type. > * The resulting typed expression is unified (3.5) with type type. 这通常影响两个操作,如当执行绝对的标识符解析(第3.7.3节)时给定类型被用为预期的类型,和抽象类型的转换的合一检查。 > This has the usual effect of both operations such as the given type being used as expected type when performing unqualified identifier resolution (3.7.3) and the unification checking for abstract casts (2.8.1).