Re: Learning C++?
From: Nicolas Pavlidis (pavnic_at_sbox.tugraz.at)
Date: 09/22/04
- Next message: Alwyn: "Re: Learning C++?"
- Previous message: Chris \( Val \): "Re: Learning C++?"
- In reply to: Alwyn: "Re: Learning C++?"
- Next in thread: Alwyn: "Re: Learning C++?"
- Reply: Alwyn: "Re: Learning C++?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 22 Sep 2004 16:44:00 +0200
Alwyn <dt015a1979@mac.com.invalid> writes:
> In article <2rcs2iF16v6krU2@uni-berlin.de>, Nicolas Pavlidis
> <pavnic@sbox.tugraz.at> wrote:
> >
> > I'd compare C++ to real life ( I know thats a bit wide, but I think you
> > understand waht I mean):
> > There are some rules you have to abide, and if you du so, you'll have no
> > problems. But, as in real life, there are some people who don't want to
> > abide such rules or there are people who don't know the rules.
> > You can have as much freedom as you like, but you'll get punished if you
> > ignore some little rules.
>
> My ideal programming language would:
>
> * Be safe, with strong type-checking at compile-time, run-time or both.
> No program that passes the compiler or interpreter should produce
> undefined behaviour. There should also be also run-time bounds
> checking, which can be turned off if necessary for increased
> performance. C++ does very poorly here, though arguably better than C.
>
> * Have the minimum in the way of 'syntax', so that it is easy to learn,
> read and compile and yet is powerful and expressive. Simplicity,
> clarity and elegance (and fast compilation speed) are not strong suits
> of C++.
>
> * Have ALGOL-type block scoping. C++ has this.
>
> * Have automatic memory management of some sort, preferably over which
> the user has some control. C++ does not have this.
Can be done by hand (Smartpointers).
> * Have built-in support for common data structures, like lists, tuples,
> records, arrays, union types and hash tables ('dictionaries'). C++ has
> some support from some of these, either built-in (arrays, enums, unions
> and structs) or via its standard library (vector, list, map), but
> tuples are restricted to pairs.
Can also be implemented.
> * Allow me to program at will in an imperative, functional or
> object-oriented style. C++'s support for imperative, procedural
> programming is excellent, and its object-oriented support is quite
> good, but objects have limited introspection (there is no way of
> telling at run-time which methods an object can execute), and
What do you mean by telling an object at runtime with method it can
execute. Mayby I missunderstand you but here are my thoughts:
You can use function pointers or objects that overload tne () -
operator. The second thing can even be created at runtime via factories.
> * Be modular. Since C++ depends on the C include-file mechanism and
> processes each compilation unit independently, it is not modular, but
> the 'class' construct (normally declared in header files) provides
> reasonable support for abstract data types.
Modularity of code always depents on the design IMHO. I know that there
are languages that are trying to enforce the programmer to write modular
code, like Java or Ada or what else, but no language can prevent the
user from writing "ugly" code.
> * Produce acceptable performance. C++ does very well here, but still
> possibly not as well as Fortran or C.
> * Be able to be compiled or interpreted. C++ interpreters are thin on
> the ground, and there are no REPLs (read-evaluate-print loops) that I
> know of.
Why do you want to switch?
> * Have good debugging support. There are useful debuggers for C++,
> though they could be better.
Thats not in the area of a language.
> * Allow the programmer low-level control where necessary. C++ is among
> the best in this department.
>
> * Have reasonable 'syntactic sugar'. C++ is OK here, but there are
> unnecessary restrictions on operator overloading.
Where? There are some operator that are noch overloadable and new
operator can not be defined, these are the only restriction I know, and
IMHO they are good.
> * Not require me to declare the type of each object I use, i.e. either
> the compiler or the run-time system should deduce it for me. In C++, I
> have to type explicitly each object I declare. This is a pain.
> Furthermore, I am required to state which functions and inherited
> classes are 'virtual'. This is also something the compiler should be
> able to deduce.
That would be the compiler writing the program for you?
> * Have support for Rapid Application Development. Standard C++ is
> hopeless in this respect, though certain proprietary extensions make it
> possible.
It's not necessary for Standard C++, because all things made in
_Standard C++_ are console applications.
> * Enable lazy evaluation where necessary. In C++, lazy evaluation is
> restricted to conditionals, as is the case with most programming
> languages, but Pascal does not have even this.
Where ales do you want to have lazy evaluation? C++ makes it in && || !
== and so on, if there is a longer statement.
> * Produce compact object code. C++ templates make for code bloat.
Thats a on the one hand a problem of the copiler builders because AFAIK
only comeau supports external templates, and on the other side a problem
of the code writer who maybe isn't aware of some things.
> * Be supported by a large and helpful user community. C++ is among the
> best in this respect, and this newsgroup is a good example.
That's true :-)
> A strong argument in favour of C++ which does not figure in the above
> list is the power of the 'template' mechanism in C++, the exploration
> of which is still far from complete. I believe many of the shortcomings
> of the language can be overcome in this manner, but at the cost of
> unwieldy syntax and decreased readability.
The biggest problem here is not only the synatx, but the error
messages. Not only once I had to ask someone to explain some error
message.
Kind regards,
Nicolas
-- | Nicolas Pavlidis | Elvis Presly: |\ |__ | | Student of SE & KM | "Into the goto" | \|__| | | pavnic@sbox.tugraz.at | ICQ #320057056 | | |-------------------University of Technology, Graz----------------|
- Next message: Alwyn: "Re: Learning C++?"
- Previous message: Chris \( Val \): "Re: Learning C++?"
- In reply to: Alwyn: "Re: Learning C++?"
- Next in thread: Alwyn: "Re: Learning C++?"
- Reply: Alwyn: "Re: Learning C++?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|