Re: Make derive-check procedure-oriented and not expression-oriented
Peter McGoron 14 Jun 2026 02:14 UTC
On 6/8/26 17:27, Artyom Bologov wrote:
> So I’m wondering: is this expansiveness worth it, or should
> derive-check be repurposed to getting procedure types instead?
I think a better version of `derive-check` would be to take and return
values, instead of expressions as datums. This would allow a simpler
runtime implementation if the value is dynamic, and would also allow a
compiler that infers types of expression to replace `derive-check`
invocations with that type. It gets rid of previous scoping/envrionment
issues and effects more obvious.
I.e.
(derive-check 10) ⇒ exact-integer? (at compile time)
(derive-check (* 10 0.1)) → (check-and? exact? integer?)) (a
compiler can optimize the actual operation out)
(derive-check x) ⇒ can be replaced if `x` is infered to only have
one value, otherwise dynamic
(derive-check car) ⇒ predicate for procedure that takes a pair (at
compile time)
-- Peter McGoron