The Artima Developer Community
Sponsored Link

Artima Developer Spotlight Forum
Bjarne Stroustrup on Concepts and the Future of C++

50 replies on 4 pages. Most recent reply: Aug 18, 2009 3:56 AM by Achilleas Margaritis

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 50 replies on 4 pages [ « | 1 2 3 4 ]
Mark Thornton

Posts: 275
Nickname: mthornton
Registered: Oct, 2005

Re: Bjarne Stroustrup on Concepts and the Future of C++ Posted: Aug 17, 2009 8:19 AM
Reply to this message Reply
Advertisement
> > In Java I invariably leave them in the shipping code
> with
> > the decision on whether to execute them made at
> runtime.
>
> Are you saying it is possible to turn the checks off in
> Java? Didn't know that.

You can't turn off language mandated checks (in a conforming VM), but you can disable assert statements and programmer implemented tests.

Oddly, turning off assert statements can sometimes result in slower code. This is because, when enabled, the JIT can assume that an assert was true in subsequent code and possibly eliminate some otherwise compulsory checks.

Terje Slettebø

Posts: 205
Nickname: tslettebo
Registered: Jun, 2004

Re: Bjarne Stroustrup on Concepts and the Future of C++ Posted: Aug 17, 2009 8:28 AM
Reply to this message Reply
> > Bottom line: There are a lot of people with strong
> > opinions about what should be done, but rather scarce
> > resources of people who are both able and willing to do
> > the actual work, and you can't expect them to do your
> > work.
>
> I don't understand how it's my work now. In this day and
> age, people specialize in certain things. We ask
> politicians to fix social problems, we ask the C++
> committee to fix the language's problems.

Right, and they put a lot of effort into improving the language, often with their own time and money.

Given that the committee is a volunteer effort, the members will work on what they think is important. This is why you can't tell them what to do, but you (anyone) _can_ contribute to the direction of the development of C++, by becoming involved in the committee work, yourself.

This is no different from any other language out there (except any language funded by taxpayer money, perhaps).

> > > What is needed by the majority of projects is:
> > >
> > > 1) a language that runs native code.
> > > 2) a language that maximizes reuse of code.
> > > 3) a language that is is safe, but it can become
> unsafe
> > if
> > > required (for performance reasons).
> > >
> > > C++ succeeds in #1 (because it does not need a
> virtual
> > > machine - although it's irrelevant if a language runs
> > on
> > > an emulator or not in the end) and #2 (due to
> > templates),
> > > but it fails completely at #3.
> >
> > I disagree with the assessment of #3. A lot of work has
> > gone into C++ to tighten up the type system, and other
> > things, to make it a safer language to use.
>
> Still, C++ is a statically and weakly typed language.

I guess it depends on your perspective. As others have pointed out, much of the weaknesses of C++'s type system is inherited from C, and C compatility was (and is) a conscious decision, for better or worse.

A language making a clean break from C would had very slim chances of succeeding. Thus, it makes sense to build on a successful language (you advocate that a new language should be compatible with C++, yourself), and then tighten it up.

> > > Personally, I would use ADA, but the world is fixed
> on
> > > C/C++.
> >
> > In such a world it may make a lot of sense to
> contribute
> > to trying to make a mainstream language like C++ a
> better,
> > safer language, than inventing a new one, which has
> little
> > hope of succeeding (as the plethora of existing
> languages
> > attest to).
>
> No, if the new language is compatible with C in a
> straightforward manner, and its simple enough, then it can
> succeed. People will enjoy writing libraries for it (both
> for psychological and economical reasons).

I think you've answered your own question: A new language wouldn't be accepted by your management. :) (and probably for good reason)

Myself, I don't even use C++ nowadays; I work with web application development, using PHP, which is more or less an untyped language, and have been doing so for several years. From this respective, C++ appears as a very strongly typed language. :)

Like you, I have bills to pay, and I can't dictate the language being used at work. We have lots of code written using PHP, so it's simply not practical (it won't make any economic sense) to rewrite it in another language.

Yet, I enjoy playing with other languages on my own free time, including - of all things - an ARM processor assembler, written in ARM assembly code (about 25,000 lines of code). which I made over a decade ago, and which I'm now updating to the lastest ARM versions.

Apart from this, I've looked at and played some with other high-level languages, like Smalltalk, Lisp, Scheme and Haskell.

There are ways of enjoying other languages, even if you may not be able to use them at work.

To put this discussion in perspective: You can at least use a statically typed language. I don't have even that. :) Yet, I'm not expecting the PHP community to toss out the language, and make one to my liking...

Alex Stojan

Posts: 95
Nickname: alexstojan
Registered: Jun, 2005

Re: Bjarne Stroustrup on Concepts and the Future of C++ Posted: Aug 17, 2009 9:49 AM
Reply to this message Reply
> > > No, safety is more important than performance. The
> > safety
> > > problems of IT, coming from C/C++, has cost so far
> > billion
> > > of dollars globally.
> >
> > As I understand, there are checked versions of the C++
> > standard/STL that may be used for those who want it.
> That
> > way, the principle of not paying for something you
> don't
> > use is still kept.
>
> On the other hand if you do use the runtime checks they
> frequently appear more expensive than in languages where
> the checks are not optional. At least that was my
> experience when last using C++.

That probably depends on which run-time checks are performed (i.e., stack corruption, use of local uninitialized variables, array bounds). In Java, for example, the class loader can check for certain things (like stack corruption) when loading the class.

Terje Slettebø

Posts: 205
Nickname: tslettebo
Registered: Jun, 2004

Re: Bjarne Stroustrup on Concepts and the Future of C++ Posted: Aug 17, 2009 10:20 AM
Reply to this message Reply
Correcting my own message:

> I think the committee is quite concerned about making C++
> a safer language to use, but safety is a complex issue,
> and there are many ways of getting there.
>
> > The only thing I can think about is reasons other
> > than technical, which I don't care about and I do not
> > wish to discuss.
>
> If you can't think of technical reasons for this, then I
> think that's more of a failure of imagination of your
> part. :)

Sorry, that wasn't quite right, so I take it back. Of course, there may be plenty of non-technical reasons for something being rejected or accepted, such as how hard or expensive something may be to teach or learn, how much it would cost to change all code after a breaking change, and so on.

I thought you perhaps alluded to dishonest reasons, but reading it again, I see you implied no such thing.

Rupert Kittinger-Sereinig

Posts: 21
Nickname: rkit
Registered: Dec, 2005

Re: Bjarne Stroustrup on Concepts and the Future of C++ Posted: Aug 17, 2009 12:22 PM
Reply to this message Reply
Achilleas,

you have argued a lot about the shortcomings that you see in C++. It might be more helpful for you to try to find the mistakes you made on your own so you can avoid them in the next project.

E.g. the third party library: somebody made the choice to use this library. Someone forgot to check whether it is safe to use it in a multithreaded environment. Theses are errors of judgement, not of the language.

Finally: if you think C++ is not the right choice for your organisation for whatever reason, try to convince your management to try something else, at least in a small project. This is certainly more promising than trying to kill a mainstream language that works well for a lot of people.

Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: Bjarne Stroustrup on Concepts and the Future of C++ Posted: Aug 18, 2009 3:56 AM
Reply to this message Reply
> Achilleas,
>
> you have argued a lot about the shortcomings that you see
> in C++. It might be more helpful for you to try to find
> the mistakes you made on your own so you can avoid them in
> the next project.
>
> E.g. the third party library: somebody made the choice to
> use this library. Someone forgot to check whether it is
> safe to use it in a multithreaded environment. Theses are
> errors of judgement, not of the language.

Indeed, but the language makes the problem worse.

>
> Finally: if you think C++ is not the right choice for your
> organisation for whatever reason, try to convince your
> management to try something else, at least in a small
> project. This is certainly more promising than trying to
> kill a mainstream language that works well for a lot of
> people.

Certainly.

Flat View: This topic has 50 replies on 4 pages [ « | 1  2  3  4 ]
Topic: Google Chrome Changes the Game Previous Topic   Next Topic Topic: Specs Without Tests Are Meaningless

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use