Opened 20 months ago

Closed 8 months ago

#1363 closed defect (fixed)

when compiled, set! will clobber previous lambda-info's

Reported by: kristianlm Owned by:
Priority: minor Milestone: 5.0
Component: unknown Version:
Keywords: Cc:
Estimated difficulty: medium


I don't really know what's going on, but set! alters the previous ##sys#lambda-info structure:

1442 klm@kth ~/chicken-5-klm ➤ cat /tmp/klm.scm
(define (foo a b c) 0)         (print foo)
(set! foo (lambda (x y z) 1))  (print foo)

1444 klm@kth ~/chicken-5-klm ➤ csc /tmp/klm.scm && /tmp/klm
#<procedure (f_218 a1 b2 c3)> ;; bad
#<procedure (foo x4 y5 z6)>   ;; good

1444 klm@kth ~/chicken-5-klm ➤ csi -s /tmp/klm.scm 
#<procedure (foo a b c)>      ;; good
#<procedure (foo x y z)>      ;; good

Change History (5)

comment:1 Changed 20 months ago by kristianlm

Note that I think it's a good idea to fix this, so that we can remove the explicitly-defined getter-with-setter info-strings of caar, caaar, cadar and all friends:

(set! caaar (getter-with-setter caaar (lambda (x y) (set-car! (caar x) y)) "(caaar p)"))

With this fix, it could just use the info-string from the getter. As of now, we can't just remove the info-strings because of this strange set! behaviour.

comment:2 Changed 18 months ago by LemonBoy

What happens here is that when we walk trough the database containing the informations gathered by the first analysis pass we only have the latest value that's been assigned to a given variable, hence set-real-name! "wires" the second lambda to the name 'foo but not the first one.
This may be fixed by calling set-real-name! in assign so that all the lambda ids are correctly associated to the variable it is bound to. This may have some adverse side effects so take this suggestion with a grain of salt.

comment:3 Changed 16 months ago by sjamaan

  • Estimated difficulty set to medium
  • Milestone changed from someday to 5.1

comment:4 Changed 8 months ago by evhan

  • Milestone changed from 5.1 to 5.0

Patch posted.

comment:5 Changed 8 months ago by sjamaan

  • Resolution set to fixed
  • Status changed from new to closed

Fixed by 1527e04682ef4d2b182151ac35a70e032875bdc6

Note: See TracTickets for help on using tickets.