Re: [Alephmodular-devel] Enum versus class?
Status: Pre-Alpha
Brought to you by:
brefin
From: Br'fin <br...@ma...> - 2003-03-02 07:59:00
|
Heh, I can't say as I blame you. Though, for better or for worse,=20 AlephModular is being used as a learning experience for me. STL was=20 something that was out there but not exactly trustable to be fully=20 implemented on the compilers I was using back then. since then I've=20 been out of the loop with a little C and mostly Perl. :) Just about the only thing tempering this is my urge to do things right=20= with a recognition that not all of what I'm going to play with is going=20= to be right from the starting line. This is also why I'm trying to be=20 really transparent with what I'm developing. We are catching mistakes=20 before I actually commit them :) I may not be happy with the speed that AlephModular is being developed,=20= or the seeming void that I'm tossing points of discussion out into. But=20= I do generally like the things that I have been committing in. This=20 particular case, I agree, was overblown, but I really like how the file=20= abstraction shaped up. Exceptions I'm still mulling over in my head. I'm used to Java's=20 exception mechanism, and still need to learn C++'s approach. The first=20= thing you're apt to see on that front is a try/catch block in main and=20= a growing use of exceptions first thrown from fatal csaslert dialogs=20 and asserts and in place of halt(). -Jeremy Parsons On Sunday, March 2, 2003, at 01:51 AM, Dietrich Epp wrote: > <rant> > > Hate to break it to you, but that is most abuse I have ever seen the=20= > C++ language take. In Ada we would write: > > type Bit_Depth is (Depth_8, Depth_16, Depth_32); > > or something along those lines. In C, it would be: > > typedef enum _bit_depth { depth_8, depth_16, depth_32 } bit_depth; > > If C++ is such a superior language, why does it take so damn much=20 > code? The above two examples provide the same functionality (although=20= > only the Ada version has the bounds checking). THE SAME=20 > FUNCTIONALITY. I could use less code programming it in assembly. Why=20= > the hell do you need bounds checking anyway? private vs. public? A=20= > class? Damn, I would have just used existing functionality. It is no=20= > wonder that the Marathon engine doesn't see any significant changes=20 > when people waste so much effort on things that really only need one=20= > line of code. > > I'm not really bashing C++, it's just that it has it's strong points=20= > and its weak points like most languages (Intercal a notable=20 > exception). C++ has exceptions - these are good! Use them! That way=20= > you don't have to manually check for errors -- essentially, instead of=20= > doing an operation and asking "Was there an error?", if there is an=20 > error it takes care of itself. Classes and namespaces: another good=20= > thing. Instead of calling BKSparseArray_GetValues (...) we can just=20= > do something like myArray.GetValues (...), or even myArray[...]. =20 > Making classes for everything you can think of? Well, do that in Ada=20= > because Ada was designed to do that, and you can imitate it with C=20 > using enum and struct, but class is a beast of a different nature and=20= > it should be treated that way. C++ has a dichotomy of classes and=20 > not-classes, you have to deal with this or use a different language=20 > like Smalltalk or Python. > > I bring this up because I hate to see projects make the mistakes that=20= > are so damn ubiquitous these days... some things should be learnt=20 > though experience, but large projects are not places for such learning=20= > of design methods. > > ----- > > "The main problem for the C++ community today is to use Standard C++=20= > in the way it was intended rather than as a glorified C or a poor=20 > man's Smalltalk." > =97 Bjarne Stroustrup (inventor of C++), "Getting =46rom The = Past=20 > To The Future" , > p. 23 C++ Report, SIGS Nov/Dec 1999 Vol1 No.10 > > C++: The power of assembly language with the ease of use of assembly=20= > language. > > "I invented the term Object-Oriented, and I can tell you I did not=20 > have C++ in mind." > =97 Alan Kay > > "C++ : an octopus made by nailing extra legs onto a dog" > > </rant> > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Alephmodular-devel mailing list > Ale...@li... > https://lists.sourceforge.net/lists/listinfo/alephmodular-devel > |