Proposal: make instatiation of a private record/variant raise a warning instead of an error

Offen
#8,458 2 Kommentare 2 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@tsnobip arbeitet bereits daran.

Seit 31.5.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

need feedback

Today, when you try to create a private record or variant, it errors:

module Foo = {
  type t = private {foo: int}
}

let bar = {Foo.foo: 9} // Error: Cannot create values of the private type Foo.t

Though, there are cases where you'd want to force the instantiation for example for testing, moving this from an error to a warning would allow this. We could use the same warning when casting to a private record/variant (cf #8457)

Vorherrschende Sprache
OCaml
Sterne
7.5k
Forks
485
Ø Merge
1 T. 2 Std.
Gemergte PRs (30 T.)
55

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus rescript-lang/rescript

Alle Issues in rescript-lang/rescript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.