Article View: comp.sys.mac.oop.macapp3
Article #352Re2: C++ (was re: bedrock defe
From: Personal Software, Alan Dail,PRT
Date: Wed, 27 Jan 1993 15:54
Date: Wed, 27 Jan 1993 15:54
48 lines
2814 bytes
2814 bytes
Larry, >You're right about this, and I haven't considered these issues. The == vs. >= problem is a flaw that C++ inherits from C. The same is true of switch >statements (where leaving out the break in each case is usually a mistake). There are other examples that cannot be blamed on C. One is the lack of a key word when overriding or overloading a method. This would give a safty check that you havn't made a mistake in your method name. Another example is the lack of the key word inherited. This allows your code to automatically adapt as your superclasses evolve. As it stands now, if you insert an override, it may never get invoked and you will not get any kind of indication from the compiler. Fortuanatly, C++ allows you to write superclassname::methodname() to get the effect of inherited. However, even then, if you change your superclass, you will have trouble. In any other OO language I'm aware of, you would have used either inherited or super originally and never run into a problem. >> like having various features clash when used together or having the wrong >I think there's a tradeoff here. You could remove lots of features from >the language, but then there would be useful things that you couldn't do. You wouldn't have to remove features, just design them to coexist better. For example, if you overload a function and then override one instance of it, all of the other instances get hidden. Why not allow these featues to coexist instead of conflict. >> defaults when using features (why isn't virtual the default?). It's a shame >C++ was designed for maximum performance. Changing the default would improve reliability without having to impact performance. All a programmer would have to do to get the performance would be to explicitly declare critical methods as nonvirtual. >For example, removing stack-based objects would simplify things >considerably, but stack-based objects are useful in many places. I agree that stack-based objects are usefull. However, I don't think they are quite the same thing as a class and could be restricted to structs. Doing this would allow class to be changed to have virtual for its default (or even better, have no default). I don't think any of these changes would this would impact the power of C++, but would make it less error prone and easier to learn. Alan
Technical Details
Message-ID:
<728150543.6883842@AppleLink.Apple.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!scifi!acheron!philabs!linus!agate!stanford.edu!apple!applelink.apple.comShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!scifi!acheron!philabs!linus!agate!stanford.edu!apple!applelink.apple.com From: ALANDAIL@AppleLink.Apple.COM (Personal Software, Alan Dail,PRT) Newsgroups: comp.sys.mac.oop.macapp3 Subject: Re2: C++ (was re: bedrock defe Message-ID: <728150543.6883842@AppleLink.Apple.COM> Date: 27 Jan 93 15:54:00 GMT Sender: daemon@Apple.COM Organization: AppleLink Gateway Lines: 48