fsharp / fsharp/fsharp.org

F# Spec doesn't mention private representation Discriminated unions

Aperta
#321 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
language-spec
Lingua principale
TeX
Stelle
311
Fork
291
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.