Closed gus-massa closed 4 years ago
After more testing, I realized my comment was wrong,. The correct reduction order is:
(let ([r (values 1 2)]) (record? 7 r))
==cp0==> (record? 7 (values 1 2))
==wrong-cptypes==> (begin 7 (values 1 2) #f)
==cptypes-or-cp0==> #f
so, fixing the error in cptypes is enough and there is no problem with single-valued?
.
I removed the second commit, but I added a special case to the reduction of ref
so if it has a missing type it use 'ptr
, so the expression is marked as single valued. cptypes.ss#diff-L1304-R1307
LGTM
The first commit fix an error in the reduction of
record?
in cptypes, hat was not checking that thertd
expression was single valued. For example inTo check if it single value, it use the type of the
rtd
expression, that has more information.Long comment:
I was considering to use a simplified version of the
single-valued?
in cp0, but the problem is that it assume that references are single valued. For example inI think that this doesn't cause a problem in cp0 because in cp0 when the expression is moved to an ignored position, it is immediately reduced
So I think it is correct, but it is not as foolproof as I like.
I was thinking about using
single-valued?
to reduce the first expression inmake-seq
in cptypes (and cp0) in caases where there is no information about the subexpressions, but I must take a more carefully look.The second commit allows the
types
to remember the reference that have a'ptr
, so it distinguish them from the ones with#f
. This is only a difference because'ptr
implies that the expression is single valued. This may increase the memory requirement, but I expect that the difference is not too much. Also, I don't expect it to be very useful now, but it may be helpful in the near future. [I have to update a few comments here and there.]