8000
Skip to content

Cptypes: more types for conditions [WIP]#4538

Draft
gus-massa wants to merge 2 commits intoracket:masterfrom
gus-massa:23-1-MoreConditions
Draft

Cptypes: more types for conditions [WIP]#4538
gus-massa wants to merge 2 commits intoracket:masterfrom
gus-massa:23-1-MoreConditions

Conversation

@gus-massa
Copy link
Copy Markdown
Contributor
@gus-massa gus-massa commented Jan 6, 2023

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 like

(lambda (x) (condition-message x) (fixnum? x))
=>
(lambda (x) (condition-message x) #f)

I 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 and condition-object are equivalent, the only difference is in the test not in the actual types. And that syntax-violation is similar to i/o-filename-error and irritants-condition and other similar something-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 a pred-$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 the rtd 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 of records. A better tracking of rtd would be more useful than a better tracking of conditions.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0