diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-06-19 00:16:02 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-06-19 00:16:02 -0700 |
commit | 34f47ed4597cd96bb53c42819ad353d293586a2a (patch) | |
tree | 97d42f52f65c187d16a740e052c0f62a9f14467e /stdlib/comp-opts.tl | |
parent | bd7ae6d2b8476292f22b193a6ec286e9823a28b3 (diff) | |
download | txr-34f47ed4597cd96bb53c42819ad353d293586a2a.tar.gz txr-34f47ed4597cd96bb53c42819ad353d293586a2a.tar.bz2 txr-34f47ed4597cd96bb53c42819ad353d293586a2a.zip |
quantile: better run-time type safety for state.
The quant_fun blindly trusts that the state object has
the correct type. But the function environment is mutable.
To fix this, we end up switching the state from cptr_typed
to cobj because cptr_typed has a weak form of safety based
on symbols that is better suited for FFI stuff. For anything
built into the language, we want it to be bulletproof.
* arith.c (quant_state_s): New symbol variable.
(quant_cls): New static variable.
(psq_ops): Rename to quant_ops.
(quant_fun): Parameter renamed to state. We use
cobj_handle to get the pointer to the context structure,
using the quant_cls class.
(quantile): Use cobj to create the context object, rather
than cptr_typed.
(arith_init): Initialized quant_state_s and quant_cls.
Diffstat (limited to 'stdlib/comp-opts.tl')
0 files changed, 0 insertions, 0 deletions