You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Has there been a follow-up somewhere on @gasche's question whether a cd_vars field should be added to Types.constructor_declaration?
The reason for that question is the following: when explicit binders for type variables were introduced for 4.14, the cd_vars field was added both to Typedtree.constructor_declaration and to Parsetree.constructor_declaration. It wasn't added to Types.constructor_declaration though. From a theoretical point of view, doing so might be good for coherency. And from a practical point of view, doing so would have the advantage that PPXs that rely on the Types module, could treat the new feature (see for exampleppx_import and the conversation about that here).
Of course, this question isn't the most urgent thing right now, so feel free to answer once the 5.0 alpha release work has calmed down.
The text was updated successfully, but these errors were encountered:
pitag-ha
changed the title
Add a cd_vars field to Types.constructor_declaration?
Reflect "explicit binders for type variables" feature in Types?
Jun 14, 2022
I would generally say that cd_vars should not appear in Types.constructor_declaration. The stuff in Types is supposed to represent that semantic type, and doesn't generally contain additional data about the exact syntax that was used. Obviously we remember some syntactic information to improve error messages, but mostly we throw that stuff away.
I think that ppx_import shouldn't really need cd_vars to produce valid syntax. It should be possible both to add explicit binders for all bound type variables or to produce no explicit binders, and either would seem to be fine for its use case.
Thanks a lot for the nice and quick answer @lpw25! I'm convinced now that the explicit binders shouldn't be reflected in Types (I wasn't aware they don't have any impact on the semantics at all, and not even on the error messages).
Has there been a follow-up somewhere on @gasche's question whether a
cd_vars
field should be added toTypes.constructor_declaration
?The reason for that question is the following: when explicit binders for type variables were introduced for 4.14, the
cd_vars
field was added both toTypedtree.constructor_declaration
and toParsetree.constructor_declaration
. It wasn't added toTypes.constructor_declaration
though. From a theoretical point of view, doing so might be good for coherency. And from a practical point of view, doing so would have the advantage that PPXs that rely on theTypes
module, could treat the new feature (see for exampleppx_import
and the conversation about that here).Of course, this question isn't the most urgent thing right now, so feel free to answer once the 5.0 alpha release work has calmed down.
The text was updated successfully, but these errors were encountered: