Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!asylum!osc!jgk From: jgk@osc.COM (Joe Keane) Newsgroups: comp.object Subject: Re: Documenting OO Systems Summary: You can't program in English. Keywords: operators Message-ID: <4693@osc.COM> Date: 28 Mar 91 01:01:36 GMT References: <299@orbit.gtephx.UUCP> <1991Mar25.145441.1@happy.colorado.edu> <20106@alice.att.com> <3481@engadm3.csd.mot.com> <1991Mar26.191259.14470@i88.isc.com> Reply-To: jgk@osc.COM (Joe Keane) Organization: Versant Object Technology, Menlo Park, CA Lines: 48 Personally, i think arguing over `=' versus `:=' is silly. When people get hot over this issue, you know they don't have anything important to worry about. Usually in this group we argue about more sophisticated stupid issues like operator overloading and polymorphism. I often see people complain that C doesn't look enough like English. All i can say is, wake up. English sucks as a programming language. Humans tend to deal with ambiguity pretty well, but compilers don't. They take what you said literally, or else they don't take it at all. Besides that, Americans tends to forget that not everyone in the world speaks English. Things like `+', `0', and `<' are pretty much the same no matter where you go. Are you going to translate `or' into `o', `ou', and any number of other things? That's why i don't like `improvements' like using `or' instead of `|'. I consider this simplifying so much that it's wrong. There's the obvious objection that there are two `or' operators in C. Sometimes you can interchange them, but in general you know which one you want. Clearly the English word isn't very precise. Similarly i think using the word `real' for a floating-point number is a mistake. Floating-point numbers aren't real numbers, and by glossing over this distinction you can only make things worse. The set of floating-point numbers on a give machine is finite, while the set of real numbers is not only infinite but also non-denumerable. Floating-point addition isn't associative, they don't obey the distributive law, they don't have exact inverses. Need i go on? My point is that making something simpler at the expense of making it wrong isn't something you want to do in a programming language. One thing i like about C is that when you type something you know what it's going to do. There are some catches, like operator precedence isn't what it should be in some cases. But in general when you say `a = b', you're pretty sure what the compiler's going to do with this. I wish i could say the same thing about C++, but i'm afraid this is one of the big differences between the two languages. There are a number of causes, including inline functions, virtual inheritance, invisible copy constructors, and i'm sure there are more. The end result is that when you say `a = b', you have no idea what the compiler is actually going to put there. So you type a one-line C++ function, but when you look at the assembly version it's 100 lines. (Long ago i gave up reading the cfront output. Compiling it to assembler improves the readability.) This is a little distressing at first, but finally you just have to accept that C++ is far from a WYSIWYG language. -- Joe Keane, C++ hacker