Cptypes: more types for conditions [WIP] #4538
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The first commit is almost mergeable. I'm still finding a few more signatures of primitives that can be improved.
The idea is to mark the
conditions
as records in cptype. This allows a few reductions likeI don't expect many of them, but it's almost free because all the logic is already implemented for other types.
Edit: I'm assuming that in primdata.ss the
condition
andcondition-object
are equivalent, the only difference is in the test not in the actual types. And thatsyntax-violation
is similar toi/o-filename-error
andirritants-condition
and other similarsomething-condition
.The second commit causes an error, but I can't find the problem.
The idea is to use the
rtd
of a condition to make apred-$record/rtd
and use it as the type for all the conditions. This is a subtype of$record
so it would enable a few more reductions.I'm not sure why there is an error. Is it possible to use the
rtd
of the code running the compiler and compare it to thertd
of the objects in the compiled code? Or perhaps there is a wrong signature. Or perhaps there is a silly mistake somewhere.(If this is fixed, I'd like to add later a similar detailed type for
rtd
, that are currently tracked only as a subtype ofrecords
. A better tracking ofrtd
would be more useful than a better tracking ofconditions
.)