-
Notifications
You must be signed in to change notification settings - Fork 471
Closed
Description
type t = {
y : int
}
let x = {"x" : { y : 3}}
let u : t = x["x"]
Here the nested record is still interpreted as structural type.
It used to work this way for two reasons:
- record was compiled as an array
- the ocaml syntax is quite heavy for nested structual objects, so I chose to inherit, otherwise it would be as below which is too verbose
[%obj{x = [%obj{y = 3}]]
To fix this, the work may be done on my side (the internal ppx), for rescript syntax, the structural objects will not be inherited.
This would be a breaking change for rescript syntax (in a good way).
Note this is not an issue in type space, since object types have different syntax < x : int>
vs {x:int}
Question: does it make sense to change the semantics of ocaml syntax as well, not inherit the structual property inside the nested objects?
rickyvetter and jfrolich
Metadata
Metadata
Assignees
Labels
No labels