fsharp / fsharp/fsharp.org

F# Spec doesn't mention private representation Discriminated unions

未关闭
#321 3 条评论 0 个 reaction 已指派 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

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 F# 语言规范和 issue 中的 discriminated-union 示例开始。确定 private 对 union 表示形式的文档化影响,包括 C# 构造函数的可见性、F# 模式匹配以及 union-case 的构造;当规范明确说明预期行为时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
fsharp
领域
documentation
Issue 类型
文档
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。