19 lines
1.0 KiB
Plaintext
19 lines
1.0 KiB
Plaintext
;; ZII fills an omitted field with all-bytes-zero, and a zeroed function value
|
|
;; is a null pointer — the one kind of zero that is not a value the type can
|
|
;; have. Every other type's zero is one: 0, false, an empty slice, None, a
|
|
;; union's first case. So it is refused where the field is written rather than
|
|
;; left to crash at the call, and the same rule covers a global, a fixed
|
|
;; array's element and (zeroed).
|
|
;;
|
|
;; The zero is the whole objection: a capturing value's environment belongs to
|
|
;; the collector and may be kept anywhere, and (Option (Fn ...)) is the field
|
|
;; that holds one — see fn-escape.flan.
|
|
;;
|
|
;; Which means a (CFn ...) field is refused too, and for the zero alone —
|
|
;; a table of function pointers is exactly what that type is for, and nothing
|
|
;; about capture stands in its way. An (Option (CFn ...)) field is already
|
|
;; legal and is the shape that works; TODO.org, "CFn in a struct or a fixed array", carries the rest as its own item.
|
|
(defstruct Ops [run (Fn [i32] i32)])
|
|
|
|
(defn main [] i32 0)
|