@@ -262,9 +262,24 @@ specify a mode along the contention axis, the expression behaves as if it contai
262
262
` contended ` . This rule still allows you to write e.g. ` t @ immutable uncontended `
263
263
if that's what you want; most users will never want this, though.
264
264
265
- Though this description centers on ` immutable ` and ` contended ` , other implications
266
- exist, all to lower users' annotation burden. The implications apply both to
267
- mode expressions and to modality expressions, and are specified by this table:
265
+ Once we've done this for modes, it would be odd if we didn't also do this
266
+ for modalities. For example, ` local ` implies ` yielding ` . Now consider
267
+ ``` ocaml
268
+ type 'a glob = { g : 'a @@ global }
269
+ let unglob (r : 'a glob @ local) : 'a = r.g
270
+ ```
271
+ Because of the mode implication, ` r ` has mode ` local yielding ` . The written
272
+ ` global ` modality means that ` r.g ` will have mode ` global ` (corresponding to
273
+ the unwritten legacy ` global ` on the return type of ` 'a ` ). But without a
274
+ ` unyielding ` modality, then ` r.g ` will have mode ` yielding ` , which is not
275
+ compatible with a return expecting the legacy ` unyielding ` . We thus extend
276
+ implications to include modalities, such that ` global ` implies ` unyielding ` ,
277
+ thus getting ` unglob ` to type-check (because now ` r.g ` will be ` unyielding ` ).
278
+
279
+ Other implications
280
+ exist, all to lower users' annotation burden, all applying both to modes
281
+ and modalities, according to this table:
282
+
268
283
269
284
+---------------+--------------+
270
285
| this | implies this |
0 commit comments