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
Copy file name to clipboardExpand all lines: jane/doc/extensions/unboxed-types/index.md
+13-5
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,14 @@ by a *type*. There is a small fixed set of layouts:
36
36
*`any` is a layout that is the superlayout of all other layouts. It doesn't correspond
37
37
to a specific runtime representation. More information [below](#the-any-layout).
38
38
39
+
*`value_or_null` is a superlayout of `value` including normal OCaml values
40
+
and null pointers. Unless `-extension-universe alpha` is set, it is displayed
41
+
as `value` and can't be used in jkind annotations.
42
+
*`any_non_null` is a sublayout of `any` forbidding null pointers. Unless
43
+
`-extension-universe alpha` is set, it is displayed as `any`.
44
+
Additionally, `any` jkind annotations are interpreted as `any_non_null` for
45
+
backwards compatibility for definitions using arrays.
46
+
39
47
Over time, we'll be adding more layouts here.
40
48
41
49
# Layout annotation
@@ -353,19 +361,19 @@ orders:
353
361
354
362
* Records
355
363
* Constructors
356
-
364
+
357
365
Unboxed numbers can't be put in these structures:
358
366
359
367
* Constructors with inline record fields
360
368
* Exceptions
361
369
* Extensible variant constructors
362
370
* Top-level fields of modules
363
371
* Tuples
364
-
372
+
365
373
There aren't fundamental issues with the structures that lack support. They will
366
374
just take some work to implement.
367
375
368
-
Here's an example of a record with an unboxed field. We call such a record
376
+
Here's an example of a record with an unboxed field. We call such a record
369
377
a "mixed record".
370
378
371
379
```ocaml
@@ -429,7 +437,7 @@ These operations aren't supported:
429
437
* polymorphic comparison and equality
430
438
* polymorphic hash
431
439
* marshaling
432
-
440
+
433
441
These operations raise an exception at runtime, similar to how polymorphic
434
442
comparison raises when called on a function.
435
443
@@ -453,7 +461,7 @@ scanned by the garbage collector.
453
461
[^can-or-must]: "Can-or-must" is a bit of a mouthful, but it captures the right nuance. Pointer values *must* be scanned, unboxed number fields *must* be skipped, and immediate values *can* be scanned or skipped.
454
462
455
463
The ordering constraint on structure fields is a reflection of the same
456
-
ordering restriction in the runtime representation.
464
+
ordering restriction in the runtime representation.
0 commit comments