Quantcast
Channel: Jason Andrews Blog
Viewing all articles
Browse latest Browse all 33813

pp output of `case' expression in procedure definition changes after the procedure is run

$
0
0
After further debugging, I believe I have gotten to the root cause of my `case' woes: > getVersion "@(#)$CDS: virtuoso version ICADV12.3-64b 09/01/2017 10:34 (sjfhw305) $" > sstatus printinfix nil nil > (defun foo () (case (list "M2" "M3") ((("M1" "M2")) "V1") ((("M2" "M3")) "V2"))) foo > (pp foo) (procedure (foo) (case (list "M2" "M3") ((("M1" "M2")) "V1") ((("M2" "M3")) "V2") ) ) nil > (foo) "V2" > (pp foo) (procedure (foo) (case (list "M2" "M3") (("M1" "M2") "V1") (("M2" "M3") "V2") ) ) nil > (let ((p (outfile "foo.il"))) (pp foo p) (close p)) t > (load "foo.il") function foo redefined t > (foo) nil > Note that the second time `foo' is pretty-printed, the `case' statement has lost one level of parens in each clause, altering the semantics of the definition of `foo' when it is reloaded from its `pp' output. In our environment, we use `pp' to print pcell code to a file so that it can be massaged (pre-processed) before being passed on to pcDefinePCell. This unexpected behavior of `pp' caused one engineer's `case' expression to mysteriously fail inside our pcell compilation system.

Viewing all articles
Browse latest Browse all 33813

Trending Articles