Explorer

core

Core built-in module for definy · Public

Snapshot history

Status: Done · Every branch of the project (change the status there)

core.type-env: Type  // Type environment: types of variables, types of parts, and the type parameters (parameters of type `type`) in scope
core.type-env-lookup: Fn(env: @core.type-env, var_id: Number) -> @core.type-result  // Lookup variable type in type environment
core.type-env-lookup-inner: Fn(
    variables: List<Record{variable_id: Number, var_type: @core.type-ast}>,
    var_id: Number,
    idx: Number
  ) -> @core.type-result  // (en) Inner helper for type-env-lookup recursion (ja) type-env-lookup の再帰用内部ヘルパー
core.type-env-extend: Fn(env: @core.type-env, var_id: Number, var_type: @core.type-ast) -> @core.type-env  // Extend type environment with a variable type binding
core.type-env-extend-parameter: Fn(env: @core.type-env, parameter_id: Number, parameter_name: String, var_type: @core.type-ast) -> @core.type-env  // Extend the type environment with a function parameter. A parameter of type `type` is also recorded as a type parameter so that type expressions can refer to it
core.part-type-env: Type  // Module-level part type environment mapping part definition hashes to types
core.part-type-lookup: Fn(
    env: List<List<Record{part_definition_event_hash: String, part_type: @core.type-ast}>>,
    part_hash: String
  ) -> @core.type-result  // (en) Lookup declared type of a part in the type environment's index of parts (core.build-type-env makes it with list_hash_index; the last entry with the hash wins)
core.type-env-lookup-part: Fn(env: @core.type-env, part_hash: String) -> @core.type-result  // Lookup declared type of a part in the type environment
core.type-equals: Fn(t1: @core.type-ast, t2: @core.type-ast) -> Boolean  // Compare all type-ast forms structurally
core.type-equals-apply-arguments: Fn(
    left: List<Record{name: String, type: @core.type-ast}>,
    right: List<Record{name: String, type: @core.type-ast}>,
    index: Number
  ) -> Boolean  // (en) Whether the arguments of two `apply` types are the same types by name (in any order) (ja) 2 つの apply の引数が名前ごとに同じ型か (順番によらない)
core.is-type-part-type: Fn(part_type: @core.expression) -> Boolean  // Whether a part with this type is a type part: its type is `type`, or it is a function that returns `type` (a type that takes type arguments, such as core.option)
core.type-equals-record-fields: Fn(
    left_fields: List<Record{key: String, field_type: @core.type-ast}>,
    right_fields: List<Record{key: String, field_type: @core.type-ast}>,
    index: Number
  ) -> Boolean  // (en) Recursively compare ordered record type fields (ja) レコード型のフィールド一覧を順序付きで再帰比較
core.type-equals-function-parameters: Fn(
    left_parameters: List<Record{name: String, type: @core.type-ast}>,
    right_parameters: List<Record{name: String, type: @core.type-ast}>,
    index: Number
  ) -> Boolean  // (en) Recursively compare ordered function type parameters (ja) 関数型のパラメータ一覧を順序付きで再帰比較
core.type-equals-union-variants: Fn(
    left_variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    right_variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    index: Number
  ) -> Boolean  // (en) Recursively compare ordered union type variants (ja) union 型の variant 一覧を順序付きで再帰比較
core.record-field-type-lookup: Fn(fields: List<Record{key: String, field_type: @core.type-ast}>, key: String, index: Number) -> @core.type-result  // Looks up a field's type in an ordered record field type list
core.type-check-record-fields: Fn(
    fields: List<Record{key: String, value: @core.expression}>,
    env: @core.type-env,
    index: Number,
    accum: List<Record{key: String, field_type: @core.type-ast}>
  ) -> @core.type-result  // (en) Recursively type-checks record expression fields to infer a record type (ja) レコード式の各フィールドを再帰的に型検査してレコード型を構築する関数
core.type-assignable-record-fields: Fn(
    expected_fields: List<Record{key: String, field_type: @core.type-ast}>,
    actual_fields: List<Record{key: String, field_type: @core.type-ast}>,
    index: Number,
    env: @core.type-env
  ) -> Boolean  // (en) Check if actual record fields satisfy expected fields (structural width subtyping) (ja) 期待される全フィールドが実際のレコードに含まれているか検証(構造的幅サブタイピング)
core.type-assignable-function-parameters: Fn(
    expected_parameters: List<Record{name: String, type: @core.type-ast}>,
    actual_parameters: List<Record{name: String, type: @core.type-ast}>,
    index: Number,
    env: @core.type-env
  ) -> Boolean  // (en) Check contravariant subtyping for ordered function parameters (ja) 関数パラメータの順序付き反変サブタイピング検証
core.union-variant-type-lookup: Fn(
    variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    tag: String,
    index: Number
  ) -> @core.type-result  // (en) Lookup payload type by variant tag in union type variants (ja) 直和型のバリアント一覧からタグ名でペイロード型を探索
core.match-arm-body: Fn(arms: List<@core.match-arm>, target_tag: String, target: @core.expression, index: Number) -> @core.expression  // Find the body of the first match arm whose tag equals target_tag or is the wildcard `_`
core.check-union-exhaustiveness: Fn(
    variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    patterns: List<@core.pattern>,
    env: @core.type-env,
    index: Number,
    return_type: @core.type-ast
  ) -> @core.type-result  // (en) Verify that all variants in a union are covered by pattern match arms (ja) 直和型のすべてのバリアントがマッチアームで網羅されているか検査
core.match-arm-patterns: Fn(arms: List<@core.match-arm>, index: Number, acc: List<@core.pattern>) -> List<@core.pattern>  // The patterns of the match arms from index, appended to acc
core.patterns-any-irrefutable: Fn(patterns: List<@core.pattern>, index: Number) -> Boolean  // Whether a pattern from index matches every value
core.patterns-sub-patterns: Fn(patterns: List<@core.pattern>, tag: String, index: Number, acc: List<@core.pattern>) -> List<@core.pattern>  // The patterns for the value inside the tag, from the patterns (from index) that can match a value with the tag. A pattern that matches every value gives `_`
core.patterns-exhaustive: Fn(patterns: List<@core.pattern>, type: @core.type-ast, env: @core.type-env) -> Boolean  // Whether the patterns cover every value of type. Nested patterns are checked recursively against the payload types
core.patterns-cover-variants: Fn(
    patterns: List<@core.pattern>,
    variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    env: @core.type-env,
    index: Number
  ) -> Boolean  // (en) Whether the patterns cover every value of each tag from index (ja) index 番目以降の全てのタグについて, そのタグの全ての値にパターンが一致するか
core.patterns-cover-variant: Fn(
    patterns: List<@core.pattern>,
    variant: Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}},
    env: @core.type-env
  ) -> Boolean  // (en) Whether the patterns cover every value with the tag (ja) パターンがそのタグの全ての値に一致するか
core.type-assignable-union-variants: Fn(
    actual_variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    expected_variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    index: Number,
    env: @core.type-env
  ) -> Boolean  // (en) Verify that actual union variants are assignable to expected union variants (ja) 実際の直和型バリアントが期待される直和型バリアントに代入可能か再帰判定
core.match-arm-env: Fn(
    arm: @core.match-arm,
    variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    target_type: @core.type-ast,
    env: @core.type-env
  ) -> Union{#ok(@core.type-env), #error(@core.type-error)}  // (en) Extends the type environment with the payload variable of a match arm (ja) パターンマッチのアームのペイロード変数を型環境に加える関数. `_` アームと, 対象の型に無いタグでペイロードを束縛しないアーム (到達しないアーム) は何も束縛しない
core.eval-pattern: Fn(pattern: @core.pattern, value: @core.value, env: @core.env) -> Union{#none, #some(@core.env)}  // Matches value against pattern. some(env with the bound variables) if it matches, none otherwise
core.pattern-irrefutable: Fn(pattern: @core.pattern) -> Boolean  // Whether the pattern matches every value (any or bind)
core.pattern-covers-tag: Fn(pattern: @core.pattern, tag: String) -> Boolean  // Whether the pattern matches every value of the variant tag (for the exhaustiveness check). Booleans use the tags "true" / "false"
core.pattern-bound-variables: Fn(pattern: @core.pattern) -> List<Number>  // Variable IDs the pattern binds
core.pattern-target-variants: Fn(type: @core.type-ast, env: @core.type-env) -> List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>  // Variants a pattern can name for a target of type (the union's variants, true / false for booleans, none otherwise)
core.type-check-pattern: Fn(
    pattern: @core.pattern,
    target_type: @core.type-ast,
    variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    env: @core.type-env
  ) -> Union{#ok(@core.type-env), #error(@core.type-error)}  // (en) Checks a pattern against the target type and returns the type environment with the variables it binds (ja) パターンを対象の型で検査し, パターンが束縛する変数を足した型環境を返す
core.type-check-match-arms-infer: Fn(
    arms: List<@core.match-arm>,
    variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    target_type: @core.type-ast,
    env: @core.type-env,
    index: Number,
    acc_type: Union{#none, #some(@core.type-ast)},
    skipped: List<Number>
  ) -> Union{#ok(Record{type: @core.type-ast, skipped: List<Number>}), #error(@core.type-error)}  // (en) Infers the type of a match from the arms whose body type can be inferred, widening it across arms (ja) 推論できるアームの本体の型から match 全体の型を求める関数. アームごとに広い方の型を採り, 推論できないアーム (空リストなど) の番号は後で期待型で検査するために集める
core.type-check-match-arms-skipped: Fn(
    arms: List<@core.match-arm>,
    variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    target_type: @core.type-ast,
    env: @core.type-env,
    skipped: List<Number>,
    index: Number,
    expected_type: @core.type-ast
  ) -> @core.type-result  // (en) Checks the match arms whose type could not be inferred against the inferred match type (ja) 型を推論できなかったアームの本体を, 推論した match 全体の型で検査する関数
core.type-check-match-arms: Fn(
    arms: List<@core.match-arm>,
    variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    target_type: @core.type-ast,
    env: @core.type-env
  ) -> @core.type-result  // (en) Verify pattern match arms and deduce unified branch return type (ja) パターンマッチのアームを型検査し, 全アームを受け入れる match 全体の型を求める関数
core.type-check-list-items: Fn(
    items: List<@core.expression>,
    env: @core.type-env,
    index: Number,
    expected_item_type: @core.type-ast
  ) -> @core.type-result  // (en) Recursively type check list items against expected element type (ja) リストリテラルの各要素を期待される要素型に対して再帰検査
core.type-check-list: Fn(items: List<@core.expression>, env: @core.type-env) -> @core.type-result  // Type check list literal expression deriving element type
core.type-assignable: Fn(actual_type: @core.type-ast, expected_type: @core.type-ast, env: @core.type-env) -> Boolean  // (en) Check if actual type is assignable to expected type with width subtyping
core.type-resolve: Fn(type: @core.type-ast, env: @core.type-env) -> @core.type-ast  // Expands a reference type to the definition of the type part, following references to other type parts, using the type environment
core.type-resolve-from: Fn(type: @core.type-ast, env: @core.type-env, seen: List<String>) -> @core.type-ast  // (en) Expands a reference type through chains of type part references, including a type part whose definition is a call of a part that returns a type (a type alias such as definy.service-io = definy.io(A: ...)). Stops at a reference already in seen (a cycle without a type constructor)
core.type-substitute: Fn(type: @core.type-ast, arguments: List<Record{name: String, type: @core.type-ast}>) -> @core.type-ast  // Replace the type parameters `parameter(name)` in the type with the types given by name in `arguments`
core.type-substitute-parameters: Fn(
    parameters: List<Record{name: String, type: @core.type-ast}>,
    arguments: List<Record{name: String, type: @core.type-ast}>,
    index: Number,
    accum: List<Record{name: String, type: @core.type-ast}>
  ) -> List<Record{name: String, type: @core.type-ast}>  // (en) core.type-substitute for each type of a list of {name, type} (parameters of a function type, arguments of apply) (ja) {name, type} の一覧 (関数の型の引数, apply の引数) の型それぞれに core.type-substitute する
core.type-substitute-fields: Fn(
    fields: List<Record{key: String, field_type: @core.type-ast}>,
    arguments: List<Record{name: String, type: @core.type-ast}>,
    index: Number,
    accum: List<Record{key: String, field_type: @core.type-ast}>
  ) -> List<Record{key: String, field_type: @core.type-ast}>  // (en) core.type-substitute for each field type of a record type (ja) レコード型のフィールドの型それぞれに core.type-substitute する
core.type-substitute-variants: Fn(
    variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    arguments: List<Record{name: String, type: @core.type-ast}>,
    index: Number,
    accum: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>
  ) -> List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>  // (en) core.type-substitute for each payload type of a union type (ja) 直和型の値の型それぞれに core.type-substitute する
core.type-reference-cycle: Fn(type: @core.type-ast, env: @core.type-env, seen: List<String>) -> Boolean  // Whether following type part references from type returns to a reference without reaching a type constructor
core.type-check-binary: Fn(
    left: @core.expression,
    right: @core.expression,
    env: @core.type-env,
    operand_type: @core.type-ast,
    result_type: @core.type-ast
  ) -> @core.type-result  // (en) Checks both operands of a binary operator against the operand type (ja) 二項演算の左右の式を被演算子の型で検査し, 演算結果の型を返す関数
core.type-check-match-arms-against: Fn(
    arms: List<@core.match-arm>,
    variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    target_type: @core.type-ast,
    env: @core.type-env,
    expected_type: @core.type-ast,
    index: Number
  ) -> @core.type-result  // (en) Checks every match arm body against the expected type and verifies exhaustiveness (ja) パターンマッチの各アームの本体を期待される型で検査し, 網羅性を確かめる関数. `_` アームはどのタグにも一致する
core.record-literal-has-key: Fn(fields: List<Record{key: String, value: @core.expression}>, key: String, index: Number) -> Boolean  // Checks whether a record literal has the given key
core.type-check-record-required-fields: Fn(
    expected_fields: List<Record{key: String, field_type: @core.type-ast}>,
    fields: List<Record{key: String, value: @core.expression}>,
    index: Number
  ) -> @core.type-result  // (en) Checks that a record literal has every field the expected record type requires (ja) 期待されるレコード型が要求するフィールドがすべてレコードリテラルにあるか検査する関数
core.type-check-record-fields-against: Fn(
    fields: List<Record{key: String, value: @core.expression}>,
    env: @core.type-env,
    expected_fields: List<Record{key: String, field_type: @core.type-ast}>,
    index: Number
  ) -> @core.type-result  // (en) Checks record literal fields against the field types of the expected record type (ja) レコードリテラルの各フィールドを, 期待されるレコード型のフィールドの型で検査する関数. 期待される型に無いフィールドは推論する
core.type-check: Fn(expr: @core.expression, env: @core.type-env) -> @core.type-result  // Self-hosted type checker verifying expressions and deriving types. Errors are located at the innermost expression where they were found
core.type-check-unlocated: Fn(expr: @core.expression, env: @core.type-env) -> @core.type-result  // Body of type-check. Errors are returned without the expression where they were found
core.type-check-record-get: Fn(record_get: Record{record: @core.expression, key: String}, env: @core.type-env) -> @core.type-result  // Type of a record field access (the field may be a function)
core.type-check-callee: Fn(callee: @core.callee, env: @core.type-env) -> @core.type-result  // Type of what a call calls. Unlike a variable or part reference written as a value, it may be a function
core.type-check-value-not-function: Fn(result: @core.type-result, env: @core.type-env) -> @core.type-result  // Rejects a function written as a value (a variable, part reference or record field of a function type that is not called). Functions are only called, and a function argument is written as a lambda
core.type-check-builtin-call: Fn(name: String, arguments: List<Record{name: String, value: @core.expression}>, env: @core.type-env) -> @core.type-result  // Type-check a call to the compiler built-in with the name
core.list-contains-string: Fn(list: List<String>, target: String, index: Number) -> Boolean  // Checks if a string list contains a target string searching forward from index
core.type-check-type-record-fields: Fn(
    fields: List<Record{key: String, value: @core.expression}>,
    env: @core.type-env,
    index: Number,
    seen_keys: List<String>
  ) -> @core.type-result  // (en) Recursively checks field type expressions in a record type declaration and detects duplicates (ja) レコード型宣言の各フィールド型式を再帰検査し、重複キーを検出
core.type-check-type-union-variants: Fn(
    variants: List<Record{tag: String, payload_type: Union{#none, #some(@core.expression)}}>,
    env: @core.type-env,
    index: Number,
    seen_tags: List<String>
  ) -> @core.type-result  // (en) Recursively checks payload type expressions in a union type declaration and detects duplicates (ja) ユニオン型宣言の各バリアント型式を再帰検査し、重複タグを検出
core.type-check-type-function-parameters: Fn(
    parameters: List<Record{name: String, type: @core.expression}>,
    env: @core.type-env,
    index: Number,
    seen_names: List<String>
  ) -> @core.type-result  // (en) Recursively checks parameter type expressions in a function type declaration and detects duplicates (ja) 関数型宣言の各引数型式を再帰検査し、重複パラメータ名を検出
core.type-check-call-arguments: Fn(
    parameters: List<Record{name: String, type: @core.type-ast}>,
    arguments: List<Record{name: String, value: @core.expression}>,
    env: @core.type-env,
    index: Number,
    return_type: @core.type-ast
  ) -> @core.type-result  // (en) Recursively checks function call arguments against parameter types and names (ja) 関数呼び出しの引数リストをパラメータの名前と型に対して再帰検査
core.type-call-type-arguments: Fn(
    parameters: List<Record{name: String, type: @core.type-ast}>,
    arguments: List<Record{name: String, value: @core.expression}>,
    env: @core.type-env,
    index: Number,
    accum: List<Record{name: String, type: @core.type-ast}>,
    return_type: @core.type-ast,
    expected_type: Union{#none, #some(@core.type-ast)}
  ) -> Union{#ok(List<Record{name: String, type: @core.type-ast}>), #error(@core.type-error)}  // (en) The type arguments of a call: for each parameter of type `type`, check the argument against `type` and convert it to core.type-ast. An argument that is not entered (hole) is inferred with core.type-infer-type-argument (ja) 呼び出しの型引数: 型が type の引数それぞれについて, 実引数を type として検査して core.type-ast にする。未入力 (hole) の型引数は core.type-infer-type-argument で推論する
core.type-match-parameter: Fn(pattern: @core.type-ast, actual: @core.type-ast, name: String) -> Union{#none, #some(@core.type-ast)}  // Infer the type argument `name`: match the parameter type `pattern` (which may contain parameter(name)) against the actual type, and return the type at the position of parameter(name)
core.type-match-parameter-named: Fn(
    patterns: List<Record{name: String, type: @core.type-ast}>,
    actuals: List<Record{name: String, type: @core.type-ast}>,
    name: String,
    index: Number
  ) -> Union{#none, #some(@core.type-ast)}  // (en) core.type-match-parameter over the function parameters or type arguments at the same positions (ja) 関数の引数か型引数の一覧の同じ位置どうしで core.type-match-parameter する
core.type-match-parameter-fields: Fn(
    patterns: List<Record{key: String, field_type: @core.type-ast}>,
    actuals: List<Record{key: String, field_type: @core.type-ast}>,
    name: String,
    index: Number
  ) -> Union{#none, #some(@core.type-ast)}  // (en) core.type-match-parameter over the record fields at the same positions (ja) レコードのフィールドの同じ位置どうしで core.type-match-parameter する
core.type-match-parameter-variants: Fn(
    patterns: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    actuals: List<Record{tag: String, payload_type: Union{#none, #some(@core.type-ast)}}>,
    name: String,
    index: Number
  ) -> Union{#none, #some(@core.type-ast)}  // (en) core.type-match-parameter over the union variants at the same positions (ja) 直和型のタグの同じ位置どうしで core.type-match-parameter する
core.type-infer-type-argument: Fn(
    name: String,
    parameters: List<Record{name: String, type: @core.type-ast}>,
    arguments: List<Record{name: String, value: @core.expression}>,
    env: @core.type-env,
    index: Number,
    return_type: @core.type-ast,
    expected_type: Union{#none, #some(@core.type-ast)},
    known: List<Record{name: String, type: @core.type-ast}>
  ) -> Union{#none, #some(@core.type-ast)}  // (en) Infer a type argument that is not entered (hole): from the other arguments whose parameter types contain parameter(name), in order (a lambda argument from the type of its body, with the type arguments known so far substituted into its parameter types), and otherwise from the expected type of the call and the return type (docs/type-arguments.md) (ja) 未入力 (hole) の型引数を推論する: 引数の型に parameter(name) を含むほかの引数から順に (ラムダの引数は, それまでに決まった型引数 known を引数の型に代入して本体の型を推論して), 分からなければ呼び出しの位置で期待する型と戻り値の型から求める (docs/type-arguments.md)
core.type-infer-function-body: Fn(
    fn_parameters: List<Record{parameter_id: Number, parameter_name: String}>,
    ty_parameters: List<Record{name: String, type: @core.type-ast}>,
    body: @core.expression,
    env: @core.type-env,
    index: Number
  ) -> Union{#none, #some(@core.type-ast)}  // (en) Infer the type of the body of a lambda whose parameters have the types ty_parameters (by name). Used to infer a type argument from the return type of a lambda argument (ja) 引数の型が ty_parameters (名前で対応) のラムダの本体の型を推論する。ラムダの引数の戻り値の型から型引数を推論するのに使う
core.type-check-function-call: Fn(
    function_type: Record{parameters: List<Record{name: String, type: @core.type-ast}>, return_type: @core.type-ast},
    arguments: List<Record{name: String, value: @core.expression}>,
    env: @core.type-env,
    expected_type: Union{#none, #some(@core.type-ast)}
  ) -> @core.type-result  // (en) Type-check a call of a function type: infer the type arguments that are not entered (with the expected type of the call if any), substitute the type arguments and check the arguments (ja) 関数の型の呼び出しを型検査する: 未入力の型引数を推論し (呼び出しの位置で期待する型があればそれも使う), 型引数を代入して引数を検査する
core.type-check-function: Fn(
    fn_parameters: List<Record{parameter_id: Number, parameter_name: String}>,
    ty_parameters: List<Record{name: String, type: @core.type-ast}>,
    body: @core.expression,
    return_type: @core.type-ast,
    env: @core.type-env,
    index: Number,
    expected_type: @core.type-ast
  ) -> @core.type-result  // (en) Recursively binds function parameters to type environment and checks body (ja) 関数の仮引数を型環境へ順次束縛し、本体式を戻り値型に対して検査
core.type-check-against: Fn(expr: @core.expression, env: @core.type-env, expected_type: @core.type-ast) -> @core.type-result  // Check an expression against an expected type, binding typed function parameters. Errors are located at the innermost expression where they were found
core.type-check-against-unlocated: Fn(expr: @core.expression, env: @core.type-env, expected_type: @core.type-ast) -> @core.type-result  // (en) Body of type-check-against. Errors are returned without the expression where they were found
core.type-check-against-builtin-call: Fn(
    name: String,
    arguments: List<Record{name: String, value: @core.expression}>,
    env: @core.type-env,
    expected_type: @core.type-ast,
    expr: @core.expression
  ) -> @core.type-result  // (en) Type-check a call (expr) to the compiler built-in with the name against the expected type (ja) 名前のコンパイラ組み込みの呼び出し (expr) を期待する型で型検査する
core.compile-expr-instructions: Fn(
    expr: @core.expression,
    env: List<Record{variable_id: Number, local: Number}>,
    depth: Number,
    fn_base: Number,
    ctx: Record{
      parts: List<Record{id: String, expression: @core.expression, base: Number}>,
      inlining: List<String>,
      part_index: List<List<Record{id: String, expression: @core.expression, base: Number}>>,
      strings: List<Record{value: String, address: Number}>
    }
  ) -> List<Number>  // (en) Compile an expression into instructions that leave a pointer to the boxed value (same memory layout as the Rust compiler). env maps variable ids to locals, the locals at depth and above are free temporaries, fn_base is the function table index of the first function expression in the expression (pre-order) and ctx holds the referenced parts. Unsupported expressions become unreachable (ja) 式を, 値の箱へのポインタを残す命令列にコンパイルする (メモリ上の形は Rust 製コンパイラと同じ)。env は変数 ID からローカル変数への対応, depth 以降のローカル変数は自由に使える一時領域, fn_base は式の中で前順で最初の関数の関数表の番号, ctx は参照するパーツ。対応していない式は unreachable
core.compile-builtin-call: Fn(
    name: String,
    arguments: List<Record{name: String, value: @core.expression}>,
    env: List<Record{variable_id: Number, local: Number}>,
    depth: Number,
    fn_base: Number,
    ctx: Record{
      parts: List<Record{id: String, expression: @core.expression, base: Number}>,
      inlining: List<String>,
      part_index: List<List<Record{id: String, expression: @core.expression, base: Number}>>,
      strings: List<Record{value: String, address: Number}>
    }
  ) -> List<Number>  // (en) Wasm instructions for a call to the compiler built-in with the name (unreachable if unknown) (ja) 名前のコンパイラ組み込みの呼び出しの Wasm の命令列 (知らない組み込みは unreachable)
core.compile-float-box-start: Fn(depth: Number) -> List<Number>  // The first instructions of a float value (tag 7): the tag pushed before the f64 for struct.new
core.compile-float-box-end: Fn(depth: Number) -> List<Number>  // The last instructions of a float value: struct.new of core.wasm-type-float from the tag and the f64 on the stack
core.compile-float-power-of-ten: Fn(n: Number) -> List<Number>  // Instructions that push 10^n as f64, computed the same way as core.float-power-of-ten
core.compile-float-literal: Fn(mantissa: Number, exponent: Number, depth: Number) -> List<Number>  // Instructions for the float literal mantissa × 10^exponent (the same computation as core.float-from-decimal)
core.compile-builtin-argument: Fn(
    arguments: List<Record{name: String, value: @core.expression}>,
    name: String,
    env: List<Record{variable_id: Number, local: Number}>,
    depth: Number,
    fn_base: Number,
    ctx: Record{
      parts: List<Record{id: String, expression: @core.expression, base: Number}>,
      inlining: List<String>,
      part_index: List<List<Record{id: String, expression: @core.expression, base: Number}>>,
      strings: List<Record{value: String, address: Number}>
    }
  ) -> List<Number>  // (en) Instructions for the argument named name of a compiler built-in call (ja) コンパイラ組み込みの呼び出しの, 名前が name の引数の命令列
core.compile-builtin-name: Fn(
    function: @core.callee,
    parts: List<List<Record{id: String, expression: @core.expression, base: Number}>>
  ) -> String  // (en) The name of the compiler built-in if the called function is one (directly or as a part reference), otherwise an empty string (ja) 呼び出す関数がコンパイラ組み込み (そのもの・それを参照するパーツ) なら組み込みの名前. そうでなければ空文字列
core.compile-call: Fn(
    e: Record{function: @core.callee, arguments: List<Record{name: String, value: @core.expression}>},
    env: List<Record{variable_id: Number, local: Number}>,
    depth: Number,
    fn_base: Number,
    ctx: Record{
      parts: List<Record{id: String, expression: @core.expression, base: Number}>,
      inlining: List<String>,
      part_index: List<List<Record{id: String, expression: @core.expression, base: Number}>>,
      strings: List<Record{value: String, address: Number}>
    },
    opcode: Number
  ) -> List<Number>  // (en) Wasm instructions for a call. A call of a function part calls its Wasm function directly (call, or return_call for opcode return_call_indirect) with no captured variables; other callees are closures called with call_indirect (opcode)
core.compile-string-init: Fn(strings: List<String>, index: Number, offset: Number) -> List<Number>  // Instructions of the start function that make the strings of the string table from the passive data segment 0 (array.new_data) and set them to the globals 2, 3, ... (offset is the byte offset of the string index in the segment)
core.compile-string-globals: Fn(strings: List<String>, index: Number) -> List<Number>  // The global section entries of the strings of the string table: a mutable (ref null string) initialized to null, set by the start function (core.compile-string-init)
core.compile-call-arguments-ranked: Fn(
    arguments: List<Record{name: String, value: @core.expression}>,
    rank: Number,
    env: List<Record{variable_id: Number, local: Number}>,
    depth: Number,
    fn_base: Number,
    ctx: Record{
      parts: List<Record{id: String, expression: @core.expression, base: Number}>,
      inlining: List<String>,
      part_index: List<List<Record{id: String, expression: @core.expression, base: Number}>>,
      strings: List<Record{value: String, address: Number}>
    }
  ) -> List<Number>  // (en) Instructions that push the arguments of a call from the rank rank on, in the order the function receives them (core.call-argument-rank, the order of the names), for array.new_fixed. The function indices of each argument are counted in the written order (core.call-argument-fn-base) (ja) 呼び出しの引数を, 順位 rank から関数が受け取る順 (core.call-argument-rank, 名前の順) に積む命令列 (array.new_fixed で配列にする)。各引数の中の関数の番号は書いた順で数える (core.call-argument-fn-base)
core.call-argument-with-rank: Fn(arguments: List<Record{name: String, value: @core.expression}>, rank: Number, index: Number) -> Union{#none, #some(Record{name: String, value: @core.expression})}  // The argument of the call whose rank (core.call-argument-rank) is rank, searching from index
core.compile-tail-instructions: Fn(
    expr: @core.expression,
    env: List<Record{variable_id: Number, local: Number}>,
    depth: Number,
    fn_base: Number,
    ctx: Record{
      parts: List<Record{id: String, expression: @core.expression, base: Number}>,
      inlining: List<String>,
      part_index: List<List<Record{id: String, expression: @core.expression, base: Number}>>,
      strings: List<Record{value: String, address: Number}>
    }
  ) -> List<Number>  // (en) Instructions for an expression in tail position of a function body. Calls become return_call_indirect (definy has no exceptions and needs no stack traces, so every tail call can reuse the frame); let bodies and match arm bodies stay in tail position, and other expressions use core.compile-expr-instructions (ja) 関数の本体の末尾位置の式の命令列. 呼び出しは return_call_indirect にする (definy には例外による大域脱出がなく, スタックトレースも要らないので, 末尾位置の呼び出しはすべてフレームを使い回してよい). let の本体と match のアームの本体は末尾位置のままにし, それ以外の式は core.compile-expr-instructions に任せる
core.max-local: Fn(
    expr: @core.expression,
    depth: Number,
    ctx: Record{
      parts: List<Record{id: String, expression: @core.expression, base: Number}>,
      inlining: List<String>,
      part_index: List<List<Record{id: String, expression: @core.expression, base: Number}>>,
      strings: List<Record{value: String, address: Number}>
    }
  ) -> Number  // (en) An upper bound of the local variable index used by core.compile-expr-instructions(expr, depth, ctx). Each nesting level uses at most two more locals, function bodies are compiled into separate functions, and non-function parts are inlined at the same depth (ja) core.compile-expr-instructions(expr, depth, ctx) が使うローカル変数の番号の上限. 式が 1 段深くなるごとに使うローカル変数は高々 2 つ増え, 関数の本体は別の関数になり, 関数でないパーツへの参照は同じ depth で展開される
core.max-local-in-arms: Fn(
    arms: List<@core.match-arm>,
    index: Number,
    depth: Number,
    ctx: Record{
      parts: List<Record{id: String, expression: @core.expression, base: Number}>,
      inlining: List<String>,
      part_index: List<List<Record{id: String, expression: @core.expression, base: Number}>>,
      strings: List<Record{value: String, address: Number}>
    }
  ) -> Number  // (en) Upper bound of the local variables the arms (from index) use. The body of an arm starts after the locals of its pattern (ja) index 以降のアームが使うローカル変数の番号の上限. アームの本体はパターンのローカル変数の後ろから使う
core.max-local-in-range: Fn(
    items: List<@core.expression>,
    lo: Number,
    hi: Number,
    depth: Number,
    ctx: Record{
      parts: List<Record{id: String, expression: @core.expression, base: Number}>,
      inlining: List<String>,
      part_index: List<List<Record{id: String, expression: @core.expression, base: Number}>>,
      strings: List<Record{value: String, address: Number}>
    }
  ) -> Number  // (en) The largest core.max-local of items[lo..hi) at depth (depth when the range is empty). Splits the range in half so that the recursion depth is O(log n) (ja) items の lo 以上 hi 未満の式の core.max-local の最大値 (範囲が空なら depth). 範囲を半分に割って再帰するので再帰の深さは O(log n)
core.compile-to-wasm: Fn(expr: @core.expression, parts: List<Record{id: String, expression: @core.expression}>) -> List<Number>  // Compile an expression into a Wasm module (Wasm GC) whose evaluate function returns the result value (a reference to a struct of the GC heap, read by src/stage1_compiler.ts through the exported runtime functions). parts are the parts the expression references (transitively)
core.wasm-type-value: Number  // The index of the Wasm GC type of the definy compiler output: the base struct of every definy value: (struct (field i32)) with the tag of the kind of the value (non-final, the other value structs are its subtypes)
core.wasm-type-bytes: Number  // The index of the Wasm GC type of the definy compiler output: the byte array of a string: (array (mut i8))
core.wasm-type-values: Number  // The index of the Wasm GC type of the definy compiler output: the array of values: (array (mut (ref null value))), for the items of a list, the key and value pairs of a record, the captured variables and the arguments of a function
core.wasm-type-number: Number  // The index of the Wasm GC type of the definy compiler output: a number (tag 0): (struct i32 i64)
core.wasm-type-boolean: Number  // The index of the Wasm GC type of the definy compiler output: a boolean (tag 1): (struct i32 i32)
core.wasm-type-string: Number  // The index of the Wasm GC type of the definy compiler output: a string (tag 2): (struct i32 (ref null bytes))

101–200 (of 499) Previous 100 Next 100