Path: utzoo!utgpu!attcan!uunet!lll-winken!ncis.llnl.gov!helios.ee.lbl.gov!pasteur!agate!bionet!ig!arizona!gudeman From: gudeman@arizona.edu (David Gudeman) Newsgroups: comp.lang.misc Subject: Re: What is B&D? (Re: Bondage and Discipline Languages) Message-ID: <8828@megaron.arizona.edu> Date: 22 Jan 89 05:51:03 GMT Organization: U of Arizona CS Dept, Tucson Lines: 65 In article <9175@cit-vax.Caltech.Edu> kevin@cit-vax.Caltech.Edu (Kevin S. Van Horn) writes: >In article <8784@megaron.arizona.edu> gudeman@arizona.edu (David Gudeman) >writes: > [with reference to treating a variable as an integer at one point and as > a pointer at another point] >>The question is _how_ you do it. You have to use variant records in >>Pascal and Modula-2 and unchecked_conversion in Ada. This is because >>the designers of Pascal, Modula-2, and Ada thought that sort of thing >>was dangerous, and wanted to make it inconvenient to do. The >>inconvenience was supposed to discourage such practices, and the extra >>syntax was supposed to make sure it didn't happen by accident. > >Give me a break! What's so horribly difficult and inconvenient about writing >x.f1 when you want to use x as a variable of type t1, and x.f2 when you want >to use it as a variable of type t2? Well you forgot delcaring the type. And if you change implementation slightly, you may have to find and change the declaration. And anyone reading the code has to find the declaration. And I don't recall using the word ``horrible'', or even ``difficult''. I distinctly used the word ``inconvenient'', because I meant ``inconvenient''. If I had meant ``horribly difficult'' I would have said ``horribly difficult''. > And I think you're way off base when you >say that the designers of Pascal et al. introduced variant records to make >such type conversions difficult; --------- There's that word again, you know, the one I didn't use? >they merely wanted to make them *explicit*. And that is often inconvient. (Note the exact term ``inconvient'' and please don't get confused again.) >As to your statement that, "the extra syntax was supposed to make sure it >didn't happen by accident," well I should hope so! By definition, if you used >a pointer as an integer "by accident" then what you wrote was not what you >really intended, and any rational person would want to know this. Maybe _you_ want language designers protecting you from yourself, but I can get along fine without their help. I never said (am I repeating myself?) that it was a good thing to do the conversion by accident, and I agree that any rational person would want to know when such an accident happens. Some of us rational people prefer the inconvenience of having to find out for ourselves to the inconvenience of burdening the language with extra syntax. Anyway, the issue wasn't the convenience (or horrible difficulty) of using variant records, it was the propriety of language designers trying to coerce programmers into using a particular style. Variant records are essentially a method of forcing the programmer to document certain things. Tell me though, what makes the language designer think he knows better how to document a program at language design time than I know at coding time? I can think of at least two cases in which such documentation isn't necessary. First, a short throw-away program. Second during a detailed optimizing phase of a larger program, when you are changing the implementation of something twenty times a day to measure performance. In neither case is it worthwhile to document much of anything. To those who disagree with the above paragraph, enjoy all the documenting you want. But _I_ still don't want such practices forced on me by my programming language.