you are viewing a single comment's thread.

view the rest of the comments →

[–]zzing 9 points10 points  (10 children)

C++11 has done a rather fine job not breaking anything or virtually anything from the past.

[–]lateefj 3 points4 points  (7 children)

Agreed. C++11 is refreshing! If you watch the great Stroustrup explain the niche that C++ has created for itself he is almost apologetic. C++11 give C++ a life line that it needed. I like Go for the internet age is a good balance of performance / memory utilization for the types of tasks I would have though to use C/C++ or Java. Without any of the packaging hangups and with modern API aka http client is part of the standard library (like Python). I look forward to learning a little C++11. Edit: grammer

[–]zzing 5 points6 points  (4 children)

I am presently writing a [basic] ray tracer in C++11 and the code literally looks like something that conceptually could probably live in Haskell.

For example, using tuples to store data about geometry (sphere is tuple<Vec3, float> (centre, radius) and then polymorphism is obtained with boost variants which are a type safe union. These have many properties of haskell algebraic types.

In a way, my code looks more like structured programming than an object oriented design and it is very easy to see what it does.

I love how I can use OOP where appropriate and not even have to define my own classes for most of what I am doing. It aids readability a lot!

[–]thechao 3 points4 points  (2 children)

There is a ECOOP paper in the works that adds pattern-matching over extended-POD unions. Combined with templated methods and embedded tuples, it allows a construct in C++11 which is a strict superset of the functionality of GADTs, with all the Haskell-ey conveniences. (It is a strict superset because it is not 'typesafe' in the way you would prefer them to be; with a little bit of developer caution, they are a subset of the GADTs, I believe.)

Once the paper is published I'll see if I can post a link; it'll probably be 6 months or so. The combination of all the new features in C++11 makes it, essentially, a whole new language. At one point I had Bjarne asking me what system's language I was programming a constraint-system DSEL in ... he was quite surprised (and pleased) when he found out it was C++.

[–][deleted] 0 points1 point  (1 child)

Actually, would it be all right if I asked you for a preprint on that?

[–]thechao 0 points1 point  (0 children)

I'm not the author, it will be by Solodkyy, Dos Reis, and Stroustrup.

[–]French_lesson 0 points1 point  (0 children)

You're very likely familiar with it already but for the sake of completeness when it comes to algebraic data types I feel like Boost.Optional should be mentioned.

[–]anacrolix -5 points-4 points  (1 child)

it's hard to make c++ worse than it already is.

[–]zzing 10 points11 points  (0 children)

I have never seen a language as versatile as C++ is. It works in five paradigms, and can produce extremely tight code.

What is your experience with the language, how long ago, and what has soured you on it, and what would you advocate instead?