Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does print-circle default to nil?

CLHS says

An attempt to print a circular structure with *print-circle* set
 to nil may lead to looping behavior and failure to terminate.

And then there's this:

Why does this Lisp macro as a whole work, even though each piece doesn't work?

Apparently, having *print-circle* set to nil leads to surprises. Why is *print-circle* set to nil by default on many systems? What can go wrong if I set it to t globally right from the beginning of my code?

like image 464
Le Curious Avatar asked Jul 02 '13 15:07

Le Curious


1 Answers

If you set *print-circle* to true, then all your output functions have to do cycle checking. That means they may slow down and take more memory.

If you don't actually use circular structures (and I'm not a Lisp pro, but I tend to avoid them like the plague), I wouldn't turn cycle checking on in production code.

like image 115
Fred Foo Avatar answered Oct 19 '22 17:10

Fred Foo