fsharp / fsharp/fsharp.org

F# Spec doesn't mention private representation Discriminated unions

オープン
#321 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
language-spec
主要言語
TeX
スター
311
フォーク
291
PR マージ指標
30日以内にマージされた PR はありません

説明

For example, in this type:

```
type HtmlAttribute =
private | HtmlAttribute of name:string * value:string
```

What's the effect that `private` should have? I see that in C# projects, I no longer have the `NewHtmlAttribute` constructor, but I can keep doing pattern matching and create new values with `HtmlAttribute("a", "b")` in F#. Is that the intended behaviour? I was expecting to not be able to create new values using the union case constructor, and force people to use a static method that normalizes the arguments

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。