Repository navigation
Display atomic annotation - #1496
ElectreAAS wants to merge 10 commits into
Conversation
|
I added the field in |
ada12bd to
9cfcba5
Compare
|
I've researched this and the reason why your test with the implementation ( I've looked into the implementation in exception Atomic_exn of {mutable value : int [@atomic]}It also would make sense to have a test the case where the record is anonymously attached to a constructor: type with_annot = Atomic_constr of {mutable value : int [@atomic]}Also, make sure to add a changelog entry. |
Leonidas-from-XIV
left a comment
There was a problem hiding this comment.
Looking at the language extensions document it states that both @atomic and @ocaml.atomic are valid, so I think has_atomic should support both (and there should be a test). I think that change is required.
Another possible improvement is to change the type of mutable_. If we change it from bool to an ADT like Immutable | Mutable | Atomically_mutable this could prevent the invalid state where a value is marked as atomic but not mutable. I tested it in the toplevel and the compiler accepts sucha a configuration just fine (and presumably ignores it) but I would argue that it makes sense for us to represent nonsensical states in the docs.
|
About making an ADT: I tried my hand at this, and pushed a commit on a separate branch over here -> ElectreAAS@a02bb07 It doesn't compile partially for oxcaml reasons and partly because there seems to be a conversion problem in |
|
I just took a look and it seems like a good approach! |
|
Thanks @ElectreAAS - looking good so far! I've got a few minor comments though: The annotation is only useful from 5.4+ (and in OxCaml), but we're accepting it in all versions of the compiler. Related to that, as it's meaningful in the compilers that do support the annotation, there's actually a field in the Incidentally, as it happens, I think the compiler rejects putting the Lastly, I don't think the atomic annotation is printed at the "right place" in the output. In particular, I think it comes after the modalities rather than before: Other than that, looking good! |
|
My experimentation with both the toplevel and |
Signed-off-by: Ambre Austen Suhamy <ambre@tarides.com> Signed-off-by: Marek Kubica <marek@tarides.com>
Signed-off-by: Ambre Austen Suhamy <ambre@tarides.com> Signed-off-by: Marek Kubica <marek@tarides.com>
Signed-off-by: Ambre Austen Suhamy <ambre@tarides.com> Signed-off-by: Marek Kubica <marek@tarides.com>
Signed-off-by: Ambre Austen Suhamy <ambre@tarides.com> Signed-off-by: Marek Kubica <marek@tarides.com>
Signed-off-by: Marek Kubica <marek@tarides.com>
Signed-off-by: Marek Kubica <marek@tarides.com>
Signed-off-by: Marek Kubica <marek@tarides.com>
Signed-off-by: Ambre Austen Suhamy <ambre@tarides.com> Signed-off-by: Marek Kubica <marek@tarides.com>
Signed-off-by: Ambre Austen Suhamy <ambre@tarides.com> Signed-off-by: Marek Kubica <marek@tarides.com>
Signed-off-by: Marek Kubica <marek@tarides.com>
8fb97c3 to
4bf03b3
Compare
Resolves #1405.
This PR simply parses the annotation from the cm(t)i, adds it to
TypeDecl.Field.t, and displays it.I added two simple tests showcasing the feature.
This is my first PR on this project, tell me if I'm doing something stupid