Python has a built-in variable __debug__ which is set to True when python is called without -O (optimize). The -O flag disables all assertion code.
This seems at first glance like a very easy and clean construct to rely on when coding in development versus production: in development, don't use -O, defensively litter your code with type- and sanity-checking asserts. Perform development-only debugging by testing __debug__ beforehand.
When in production, run all code is run with -O which disables asserts (speeding execution) and sets __debug__ to False.
Why is this construct not more popular? Why does nearly large-ish collection of python code re-invent a DEBUG global variable or the like and ignore __debug__?
Reading http://en.wikipedia.org/wiki/Scheme_(programming_language)
- Why the necessity for
let
,let*
, andletrec
? It seems likelet*
would do everything thatlet
can do; andletrec
can do everythinglet*
can do. If it is a matter of performance (islet
simpler and faster thanletrec
?) then could a clever interpreter determine which of the three was appropriate for any given set of definitions?
Reading http://blog.moryton.net/2007/12/computer-revolution-hasnt-happened-yet.html
- Can the "big wins" from smalltalk exist separately from some of its unusual features like
- image-based persistence
- a built-in graphics environment with (non-tiling) window manager, (crappy) code editor, and (interesting) code browser?
- (yes, because some lisps have this image-based computing idea, and some do not?)
- How does one test, package & distribute small units of smalltalk code?
- Specifically about image-based persistence:
- Doesn't a crash run the risk of massive loss of state? (read up about image-based persistence)
- Doesn't the assumption of modifying the code on a long-running vm risk corrupting the state? How does one rollback/recover?
- Examine http://stackoverflow.com/questions/722204/which-programming-languages-besides-smalltalk-are-image-based
- Long-running stateful seems more vulnerable to memory leak issues and less compatible with "ephemeral" virtual hosting. False?
- Specifically about SmallTalk's (Squeak's?) built-in graphical development environment:
- Graphical development environment as desktop environment? As operating system?
- The whizzy features of being able to interact with rotated UI elements in real-time feels slow. Can the VM take advantage of accelerated graphics libraries like OpenGL?
Before I forget, Daniel Lyons has written a huge number of thought provoking posts about these and other languages issues that I think you would find worthwhile. Here are three favorites:
I'd strongly encourage you to read them. In fact, I'd be happy to have a beer/skype session to discuss any individual one. In fact, why the hell don't I start an Atlanta CodeTalkers meetup to discuss papers, actual pieces of code everyone agrees to read, and other weird non-language specific, non-tech specific issues?!? O____O