News for hackers. Stuff that matters.
Re:Breaking all the Eggs in C++ (2015) by olooney on Sunday December 30, 2018 @01:42PM (#18790606)
For the transition from Python 2 to 3 the Python team released just such a conversion tool, aptly named "2to3." [1] This was better than handy but the transition from 2 to 3 was still lengthy and painful. In practice many of the suggested changes were unnecessary or at least needed human review (e.g. suggesting changing "for n in range(1,11)" to "for n in list(range(1,11))". Thanks, 2to3, but that code is still correct and actually faster with the iterator version of range().) Another problem was that, just like it says on the tin, 2to3 produces a version of code that only runs under Python 3, whereas most library authors during the transition time wanted a version that would run under both 2 and 3 a la the six[2] library.

So while a one-way automated refactoring script sounds like a good idea, and is strictly better than just breaking backwards compatibility and expecting everyone to deal, it wasn't an unqualified success for Python.

[1]: https://docs.python.org/3/library/2to3.html [2]: https://pythonhosted.org/six/

Re:Breaking all the Eggs in C++ (2015) by faho on Sunday December 30, 2018 @01:47PM (#18790628)
Python has the additional problem of being highly dynamic, though!

In C++'s case, the transformation tool has much more information, so more things are possible to do.

E.g. let's take the ".erase" case from the article. In python, a method

    def foo(bar):
        bar.remove(baz)
can't simply change "remove" to "erase", because it has no idea what type "bar" has.

A C++ tool sees

    void foo(std::list<sometype>& baz)
and can then safely change "remove" to "erase".
Re:Breaking all the Eggs in C++ (2015) by wbkang on Sunday December 30, 2018 @02:42PM (#18790916)
I think that breaks down as soon as templates are involved, which is very pervasive in C++ codebase.

Given

    template<typename T, typename sometype>
    void foo(T<sometype>& baz)
It's not so straightforward anymore.
Re:Breaking all the Eggs in C++ (2015) by jgtrosh on Sunday December 30, 2018 @04:46PM (#18791531)
It can still apply the operation anytime a specialized object is defined. (This is how templates are compiled, right?)
Re:Breaking all the Eggs in C++ (2015) by int0x80 on Sunday December 30, 2018 @03:23PM (#18791118)
Big problem here is the preprocessor as mentioned in the article.