Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Generally in modern languages you use libraries rather than language features, which IMO is better and shows that the language is generic enough to allow programmers to build abstractions as needed.

However, some of these (#4 in particular) are exactly supported in other "modern" languages.

    1. Assignment by name. 
    python: A = {**A, **B}
    javascript: A = {...A, ...B};

    2. Both binary and decimal data
    For these you use libraries like Decimal in python, boost::multiprecision in C++

    3. Bit strings of arbitrary length
    vector<bool>, boost::dynamic_bitset, or write your own
    in python you would use numpy

    4. A named array is normally passed by reference, as in F(A)
    In C++ you can do this for any type with a copy constructor.

    void f(A_Type& A) { ...
    ... = f(A);   // by ref
    ... = f({A}); // by value

    5. IO by name.
    Not generally done as far as I'm aware, but you could easily build this in C++. Something like
    class StdOut { void operator=(string s) { cout << s; } };
    StdOut{} = "hello\n";

    6. SORT statement
    Why not sort function? c++ std::sort, python sorted() builtin

    7. Complete implicit conversion
    Javascript is the KING here, and we all know how helpful that is....
    Of course C++ let's you define this yourself, but there isn't directly language support.


I don't think the C++ aggressive implicit conversions are particularly well liked. Saving a little verbosity by omitting an explicit conversion is rarely worth the risk of silently derailing overload resolution; it was probably already a bad trade off in PL/I.


> Generally in modern languages you use libraries rather than language features

This was exactly the feeling I got as I read his list: "these aren't features, they are, at best, nice to have library functions and syntactic sugar."




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: