News for hackers. Stuff that matters.
Re:Popular Myths about C++, Part 1 by Ragnarork on Tuesday December 09, 2014 @08:11AM (#8722476)
I'm looking forward for the next part, as the last three myths are the ones I'm waiting for their answers, as they should be pretty interesting.

C++ has come a long way, and I really feel C++ 11 could very well replace Java as a learning language for computer science students (I don't think it'd be a good choice for an introduction to programming for non CS students), and I see many benefits in this, the biggests being IMHO C++ NOT being fully object-oriented, and the possibility to do either low- or high-level stuff, depending on what you're teaching.

Re:Popular Myths about C++, Part 1 by wmt on Tuesday December 09, 2014 @02:39PM (#8725129)
My biggest issue with most garbage collection implementations is the lack of RAII. While I love the ease of reading and writing Python or Lua, I'd love to be able to create a local object, like an open file or a database connection, and have it destructed immediately on return.
Re:Popular Myths about C++, Part 1 by idbfs on Tuesday December 09, 2014 @02:50PM (#8725206)
I'm not sure about Lua, but for Python it sounds like you may be interested in the "with" statement.
Re:Popular Myths about C++, Part 1 by pjmlp on Tuesday December 09, 2014 @03:41PM (#8725569)
You can do this in all modern GC languages.

Either with a using/try with resources/with construct, or by using closures.

    // Pseudo language with FP capabilities
    let withFile filename action = 
        let fd = open filename
        action fd
        close fd

    withFile "config.sys" (fun fd -> write (readlines fd))
Real production code would also take care about proper closing the file in case of errors.