[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strong Typing, Dynamic Languages, What to do?

"Anton van Straaten" <anton@appsolutions.com> writes:

> Oscar Fuentes wrote:
> > The C++ standard does not says that _any_ _pointer_ dereference will
> > return a _well_ _constructed_ instance. If you want to stay safe,
> > avoid "naked" pointers.
> ...
> > It is not a problem with the _language_.
> Your points seem contradictory.  The "problem with the language" in this
> example is that the type system fails to detect an out of bounds access to
> an array.  The fact that the standard tells you so doesn't fix the problem,
> it merely implies that it is up to you to avoid it.

As Chris U. said, it is debatable if the type system must do bounds

The key here is the nature of the language. C++ was conceived as a
"you get what you want" paradigm. If you want performance, it lets you
avoid run-time checks. If you want safety, it lets you to do
programming in a safe way.

I can understand the POV of some people here which are academics
teaching how to program well to future professionals. For this task is
good to have a language that every time you violate one of the "good
rules" the compiler/interpreter yells at you saying you did an
error. However, sometimes is good to be able to choose among several
factors. If you want to do type safe programming in C++ you can do it
and the compiler will help you. The only requirement is that you must
know what are you doing. So it is understandable that teachers regards
C++ as type unsafe because it is unsafe for their students.