From: Paul Khuong <pvk@pv...>  20130729 14:06:34

Jan Moringen wrote: > On Mon, 20130729 at 09:13 0400, Paul Khuong wrote: > >> I recently had a sad insight into this: what does it mean when a >> function like >> (lambda () (let ((x (list 1 2 3))) (values x x))) >> is of type >> (function * (values (cons integer (cons integer (cons integer null))) >> cons&optional))? > > Wouldn't that just say "The function returns exactly two values, the > first of which is of type (cons integer (cons integer (cons integer > null))) when it is returned and the second of which is of type cons when > it is returned". In my understanding, this is independent of the fact > whether the returned values are mutated later or share structure. > > Of course, the example still ruins our scheme :( Right. I'm hoping there's some wording somewhere in the spec that disallows mutation in this case. >> Our current machinery, with lvarconservativetype (used in CAR and CDR >> derivetype and to determine array dimensions), already seems wrong here. > > I don't see why. In a case like > > (defun f () (let ((x (list 1 2))) (values x x))) > (declaim (ftype (function * (values (cons integer (cons integer null)) cons&rest nil)) f)) > (defun (g) () > (multiplevaluebind (x1 x2) (f) > (setf (car x2) #\a) > (+ (car x1) 1))) > > LVARCONSERVATIVETYPE of X1 and X2 are both (cons t t) which doesn't > seem wrong to me. Really? I'm not sure that's the intent behind LCT… Paul Khuong 