Dear DDJ,
My vote for best article of March 1993 goes to "Algorithms for Stereoscopic Imaging" by Duvanenko and Robbins. After seeing a stereo demonstration of a Tektronics display using a full-screen polarizer and passive-polarizing glasses a few years ago, I searched for a cheap alternative using glasses with liquid crystal shutters that could be used with a PC VGA display. I shortly discovered that Sega of America Inc. made such glasses for their Genesis video-game product, so I obtained a pair for about $45.00 at a local toy store.
After determining that 12 volts DC was sufficient to make a lens opaque, I built a converter to accept vertical sync or field signals sent to the display monitor and alternate the blanking voltage sent to the glasses lenses. An adapter cable tapped the VGA monitor sync signal. I used techniques similar to those described in the article to load two display pages and switch them in response to vertical interrupts. The method worked fine in noninterlaced modes using a Video 7 1012i adapter card with a Seiko CM-1440 monitor, and with a few interrupt-handler modifications, a Diamond Speedstar VGA adapter, and NEC Multisync 4-D monitor. I used the same converter to drive the glasses from a Silicon Graphics 4D80GT workstation equipped with a Genlock card, the card providing a vertical sync output.
Eventually I realized the converter box and monitor cable tap could be eliminated in the case of the PC, by utilizing a serial port RS-232 control-signal output. On my PC, the DTR signal level switches between about +-12 volts. This signal can be controlled by writing directly to the serial port. A simple circuit (Figure 1) consisting of two diodes and two resistors routes the +-12 volt level to one lens and about 0 volts to the other, unblanked lens. I built the circuit into the shell of a 25-pin connector along with a mini stereo jack into which the glasses plug. The result is a simple, easily removable interface which ensures that a given output signal polarity always blanks the same lens.
James R. Jones
Colorado Springs, Colorado
Dear DDJ,
After reading, "A Curmudgery on Programming Language Trends" by Scott Guthery (DDJ, December 1992), I feel I can add a few comments. I agree with Guthery that OOP brings nothing fundamentally new. I also agree that C++ is not a very good language. It's a large language with many semantic pitfalls. But I feel Guthery has not pointed out the weak points of OOP in general:
Thiadmer Riemersma
Bussum, The Netherlands
Dear DDJ,
In the February 1993 article "Fuzzy Logic in C," Greg Viot attributes the invention of many-valued logic to Lotfi Zadeh in 1965. However, this kind of logical calculus was introduces in the '20s in the works of Emil L. Post, Jan Lukasiewicz, and Alfred Tarki. This by no means does not depreciate Lotfi Zadeh's merits. (Lukasiewicz is also a creator of the well-known Reverse Polish Notation.)
In the same issue, Stephen Wolfram said that: "The way you make progress in mathematics is that you think of a theorem and generate a proof for it. In every other field of science, experiment is the thing that originally drives what goes on. People don't make models and theories and work out their consequences."
I think he is wrong. I agree with Fred Hoyle's science fiction novel, The Black Cloud: "Bloody bad science...Correlations obtained after experiments done is bloody bad.... Only predictions really count in science.... It's no good doing a lot of experiments first and then discovering a lot of correlations afterwards, not unless the correlations can be used for making new predictions. Otherwise it's like betting on a race after it's been run."
Janusz Rudnicki
Ste.-Madeleine, Quebec
Dear DDJ,
A brief comment on John Russel's letter about the DCW (Digital Chart of the World): A 1:1,000,000 digitized map of the world is available on four CD-ROMs for $200.00.
The four governments that contribute to this effort are indeed to be congratulated and thanked for making this database available for geographic application developers at a very reasonable price. As Russel states, the VPF-VIEW software included with the DCW leaves a lot of room for improvement; I hope some DDJ reader puts a much more robust packaging of this spatial dataset on the market soon.
As a footnote, not all the participating governments are unanimous in their support of the DCW project. Specifically, the Director of Great Britain's Ordnance Survey apparently feels that selling this dataset for "only" $200.00 constitutes "dumping" and violates the GATT (General Agreement of Trade and Tariffs). I for one take notice that $11,000,000 of "my" (U.S. taxpayer) money was used to produce the DCW; I feel I am entitled to a copy for as little as $200.00--or less.
Developers of geographic applications should also note that a remarkable spatial dataset--TIGER--is available on CD for $250.00 per disk (42 disks for the entire country). TIGER is essentially a digital street map of the entire USA, including street names and house numbers required to link to and map any data file that contains street addresses. For more information contact the Data User Services Division of the Census Bureau: 301-763-4100.
Donald F. Cooke
Lyme, New Hampshire
Dear DDJ,
In regard to Spencer Roberts's reaction to Sam Harbison's October 1992 article "Safe Programming with Modula-3" (DDJ, March 1993), Spencer asks for "just the facts" but he himself has a few facts about Ada wrong. I have programmed in Ada, mostly on Ada compilers, for six years now, and I can testify that Ada is not as safe as Modula-3.
Ada's initialization of all pointers to null helps only with uninitialized pointers, not dangling pointers. Uninitialized pointers can cause as much havoc as dangling pointers but are much easier to find by reading code. Dangling pointers are pointers to objects which were once allocated but have since been deallocated.
Spencer states that Ada automatically sets pointers to null when the user exits the block they are declared in. This accomplishes nothing, since the pointers disappear altogether at this time and can never be used anyway.
If you read the Ada Language Reference Manual (LRM) carefully, it sort of implicitly invites implementors to write a garbage collector (LRM 4.8-7..11). I know of no implementation which has done this. If there is no garbage collector, then Ada requires that all dynamically allocated objects of a particular access type (i.e., pointer type) implicitly be kept around until the user exits the block which declares the access type. This is absolutely safe but is so extremely conservative that it precludes real dynamic deallocation.
Instead, in Ada, one must use the predefined generic procedure aptly named UncheckedDeallocation. This is an explicitly programmed deallocate, and can create dangling pointers. UncheckedDeallocation does set the pointer passed to it to null, but that is trivial. The real programmer's problem is all the now-dangling copies of the pointer which might be stored, who knows where, in a multilink data structure.
In my experience, eliminating dangling pointers in a complex data structure when using explicit programmed deallocation is more difficult than writing an Ada front end, minus the deallocation. I have worked on two Ada compilers that don't even try. They just abandon the garbage nodes and hope the storage loss will be tolerable until everything can be deallocated.
They even do this for a data structure which is stored long-term in files! When you need such a dynamic data structure, garbage collection is the only way to go.
I don't understand what Spencer means by "garbage collection is always machine dependent." It is no more, or less, machine dependent than any high-level language construct. In particular, it introduces no machine dependencies to the source code in Modula-3. The implementation of garbage collection is machine dependent, but so is the implementation of the whole runtime system and the code generator. All have to be different for different machines, regardless of the language.
Spencer contends that any runtime checking is less safe than static checking. I agree, but this doesn't compare Ada and Modula-3. Both have a lot of static checking as well as some things that are checked at run time. I don't know of any instance in which Ada is more aggressive than Modula-3 in enforcing static safety. On the other hand, garbage collection is a big example where Ada is less aggressive in enforcing dynamic safety.
Rodney M. Bates
Wichita, Kansas
Copyright © 1993, Dr. Dobb's Journal