fsharp / fsharp/fsharp.org

F# Spec doesn't mention private representation Discriminated unions

Ouverte
#321 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
language-spec
Langage dominant
TeX
Étoiles
311
Forks
291
Métriques de merge des PR
Aucune PR mergée en 30 j

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Start with the F# language specification and the discriminated-union example in the issue. Determine the documented effect of private on the union representation, including C# constructor visibility, F# pattern matching, and union-case construction; done means the specification clearly states the intended behavior.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
fsharp
Domaine
documentation
Type d'issue
Documentation
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.