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?
Now for some of my armchair-speculation/bullshit:
Re: how does one test/package/distribute code?
Re: image-based-persistence questions...
I'm not sure I have a good answer for your remaining questions but yes, Smalltalk in many ways wants to be an OS. There is a good article/paper along these lines titled something like "There Shouldn't Be An Operating System" or "An OS Is A Group Of Things You Couldn't Figure Out Where To Put In Your Language" or something. Finally, you may be interested in pharo which I think has OpenGL/hardware compositing for graphics.