<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                合一 是類型系統的心臟,極大的提高Haxe程序的健壯性。它描述了檢查是否一個類型和另一個類型兼容的過程。 > Uni?cation is the heart of the type system and contributes immensely to the robustness of Haxe programs. It describes the process of checking if a type is compatible to another type. **合一** >[warning] 定義:合一 兩個類型 A 和 B之間的合一是一個定向的處理,如果A可以被分配到B則解決了問題。它可以使任何類型發生改變,如果它是或者有一個 單形(第2.9節)。 >[warning] De?nition: Uni?cation Uni?cation between two types A and B is a directional process which answers the question if A can be assigned to B. It may mutate either type if it is or has a monomorph (2.9). 合一錯誤非常容易被觸發: > Uni?cation errors are very easy to trigger: ~~~ class Main { static public function main() { // Int should be String var s:String = 1; } } ~~~ 我們嘗試分配一個Int類型的值到一個String類型變量,這會使編譯器嘗試使用String統一Int。當然,這是不允許的,使編譯器發出一個錯誤 “Int should be String”。 > We try to assign a value of type Int to a variable of type String, which causes the compiler to try and unify Int with String. This is, of course, not allowed and makes the compiler emit the error Int should be String. 在這個特殊情況下,合一被一個賦值操作觸發,一個“被分配到”的上下文定義是直觀的。這是幾種需要執行合一的情況之一: > In this particular case, the uni?cation is triggered by an assignment, a context in which the “is assignable to” de?nition is intuitive. It is one of several cases where uni?cation is performed: **賦值**:如果 a 被分配為 b,a 的類型通過 b的類型合一。 > **Assignment**: If `a` is assigned to `b`, the type of `a` is uni?ed with the type of `b`. **函數調用**:我們簡短的看過這個,當介紹函數類型(第2.6節)的時候。通常,編譯器嘗試統一第一個個指定的參數類型到第一個期待的參數類型。第二個指定的參數類型到第二個期待的參數類型等等直到所有參數類型被處理。 > **Function call**: We have brie?y seen this one while introducing thefunction(2.6)type. In general, the compiler tries to unify the ?rst given argument type with the ?rst expected argument type, the second given argument type with the second expected argument type and so on until all argument types are handled. **函數返回**:當一個函數有一個 return e 表達式,e的類型使用函數的返回類型統一。如果函數沒有明確的返回類型,它被推斷為e的類型,隨后return 表達式針對它進行推斷。 > **Function return**: Whenever a function hasa return e expression, thetypeof e is uni?ed with the function return type. If the function has no explicit return type,it is inferred to the type of e and subsequent `return` expressions are inferred against it. **數組聲明**:編譯器嘗試在一個數組聲明中尋找一個最小化的類型。連接到常用基本類型(第3.5.5節)查看細節。 > **Array declaration:** The compiler tries to ?nd a minimal type between all given types in an array declaration. Refer to Common Base Type (Section 3.5.5) for details. **對象聲明**:如果一個對象被聲明為一個特定類型,編譯器統一每個指定的字段類型到每個期待的字段類型。 > **Object declaration**: If an object is declared “against” a given type, the compiler uni?es each given ?eld type with each expected ?eld type. **操作符合一**:某些操作符期待特定的類型,指定的類型被對應統一。例如,表達式 a $$ b 統一a 和 b 為 Bool類型,表達式 a == b 統一a為b。 > **Operator uni?cation**: Certain operators expect certain types which the given types are uni?ed against. For instance, the expression a && b uni?es both a and b with Bool and the expression a == b uni?es a with b.
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看