Why does print-circle default to nil?
Asked Answered
M

1

5

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?

Merriman answered 2/7, 2013 at 15:38 Comment(0)
T
8

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.

Theona answered 2/7, 2013 at 15:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.