Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consistent mutable field in record #7306

Closed
vicuna opened this issue Jul 26, 2016 · 1 comment
Closed

consistent mutable field in record #7306

vicuna opened this issue Jul 26, 2016 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Jul 26, 2016

Original bug ID: 7306
Reporter: @bobzhang
Status: closed (set by @mshinwell on 2016-12-12T16:35:21Z)
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)

Bug description

in ocaml, we can declare a record with mutable field

type t = {mutable x : int  ; y : int}

but you can not say

let  v= {mutable x = 3 ; y = 32}

ideally, we support mutable in record construction (and pattern match maybe), and give a warning if mutable is not provided,
the use case is for safety, in general, we want to share some immutable records, however, it is not explicit whether record is mutable or not, with this feature we can easily tell the record is immutable or not

@vicuna
Copy link
Author

vicuna commented Dec 12, 2016

Comment author: @mshinwell

I don't see why this is necessary and think it unlikely to be accepted. Presumably the issue relates to determining whether such record constructions are mutable inside the compiler---but they are already marked as mutable. They have to be (at least when using Flambda) otherwise wrong optimisation might result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant