Let Over Lambda Chapter 3 Section 'Unwanted Capture' says:
"Surely we can think of rare enough names so that the problem never shows up. Yes, in many cases, packages and smart variable naming can solve the problem of variable capture. However, most serious variable capture bugs don't arise in code directly created by a programmer. Most variable capture problems only surface when other macros use your macro (combine with your macro) in ways you didn't anticipate."
and then it doesn't give me an example for the bold part. What would be one of such examples? Imagine a hypothetical Lisp dev team where its mad boss banned the use of gensym or anything that creates uninterned symbols and the programmers simply resort to throwing alphanumeric dice to come up with random variable names like temp-27s63f8sk2n or sum-3t84hj4df whenever they miss gensym. What would be an example where the team will get in trouble?
Speaking of which, Emacs 24.3.1 defines dotimes and dolist without using uninterned symbols. Weird.
OK, then I'd propose automating that process of "throwing alphanumeric dice". Of course, it doesn't have to be random, you could just use a counter. Additionally, it would be nice to be able to specify a prefix, for debugging. Oh wait, that is exactly what gensym
does.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With