fsharp / fsharp/fsharp.org

F# Spec doesn't mention private representation Discriminated unions

Open
#321 3 comments 0 reactions 0 assignees View on GitHub
language-spec
Dominant language
TeX
Stars
311
Forks
291
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.