Better output for Tagged Variants with non-inline record
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 45/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- javascript, ocaml
- 領域
- compilers
調査の方向性
Issue には再帰的な tagged-variant の例と、現在の JavaScript 出力および望ましい JavaScript 出力が示されています。まずその例を再現し、tagged-variant レコードを出力するコンパイラーパスを追跡してください。適用される tag/フィールド名と単一レコードの制約を明らかにし、そのうえで、その例が _0 ラッパーなしのフラット化されたフィールドを生成することを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Inline records in Variant provide good JS output, which is especially useful for bindings. When combined with tagged variants, they also provide a better DX.
However, it’s not always possible to inline records (or spread them in the case of recursive types), so I’m wondering if it would be possible to improve the JS output in the case of tagged variants.
One possible constraint would be to verify that the tag does not conflict with any of the record fields. We could also keep the same constraint as inline records: only one record.
@tag("nodeType")
type rec node =
| @as(1) Element(element)
| @as(3) Text(text)
| @as(9) Document(document)
and element = {
childNodes: array<node>,
ownerDocument: null<document>,
}
and text = {
nextElementSibling: null<element>,
}
and document = {
children: array<element>,
}
let anElement = Element({
childNodes: [Text({nextElementSibling: Null.null})],
ownerDocument: Null.null,
})
Current output:
let anElement = {
nodeType: 1,
_0: {
childNodes: [{
nodeType: 3,
_0: {
nextElementSibling: null
}
}],
ownerDocument: null
}
};
Wanted output:
let anElement = {
nodeType: 1,
childNodes: [{
nodeType: 3,
nextElementSibling: null
}],
ownerDocument: null
};
- 主要言語
- OCaml
- スター
- 7.5k
- フォーク
- 485
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 55
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rescript-lang/rescript のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
rescript-lang/rescript#8659 · コメント 2 件 · リアクション 2 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
rescript-lang/rescript#8647 ·
-
rescript-lang/rescript#8632 · 担当者 1 名 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
rescript-lang/rescript#8624 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
rescript-lang/rescript#8596 · コメント 2 件 ·
rescript-lang/rescript の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
objectionary/jeo-maven-plugin#1758 ·
-
mlir
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
llvm/llvm-project#224908 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
area-CodeGen-coreclr untriaged
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
secondlife/sl-vscode-plugin#147 ·