News for hackers. Stuff that matters.
Re:A Clever Line of JavaScript by cominous on Saturday December 02, 2017 @04:56AM (#15831221)
I think it was Bjarne Stroustrup who said something like - "don't be clever, be simple and obvious".

... still nice article... ;)

Re:A Clever Line of JavaScript by k__ on Saturday December 02, 2017 @05:51AM (#15831349)
Was he trying to be funny after he did c++?!
Re:A Clever Line of JavaScript by krylon on Saturday December 02, 2017 @06:13AM (#15831413)
It is possible to write simple and obvious code in C++. A lot of people just choose not to. ;-)
Re:A Clever Line of JavaScript by camus2 on Saturday December 02, 2017 @06:24AM (#15831436)
> It is possible to write simple and obvious code in C++. A lot of people just choose not to. ;-)

You still need to be C++ fluent enough to be able to read other people's code. And it's not like everybody has the same definition of "simple and obvious".

Re:A Clever Line of JavaScript by krylon on Saturday December 02, 2017 @01:59PM (#15833368)
> And it's not like everybody has the same definition of "simple and obvious".

That is a very good point. I had an interesting discussion with a Perl programmer once regarding the use of Perl's default variable $_ - to him, code that relied heavily on it was straightforward and readable. But to a newcomer, it can be very tricky to figure out what is going on. And even to an experienced Perl programmer, it can increase the mental overhead of parsing code significantly if s/he is not used to it.

Re:A Clever Line of JavaScript by coldtea on Saturday December 02, 2017 @08:09AM (#15831719)
>And it's not like everybody has the same definition of "simple and obvious".

No, but it's like we can expect of people to more or less agree on a definition of "simple and obvious" or else be outliers.

Re:A Clever Line of JavaScript by dvddgld on Saturday December 02, 2017 @08:43AM (#15831815)
True, though languages should be designed so that it is difficult to write obscure, tricky or otherwise unreadable code.
Re:A Clever Line of JavaScript by krylon on Saturday December 02, 2017 @01:55PM (#15833344)
For better or worse, languages that put am emphasis on readable code tend to remain not-so-popular. Python is an example, but Ada or Pascal are relatively unpopular these days.

But that is one thing I like about Go, because "idiomatic" Go code tends to be very straightforward and readable.

Re:A Clever Line of JavaScript by dvddgld on Saturday December 02, 2017 @06:13PM (#15834826)
I mean C++ isn't going to disappear anytime too soon, but I like where we're headed with language design. Python isn't just popular, it's monumentally popular, and I think that's a great sign. In my eyes, Ada and Pascal aren't missed, precisely because there are better choices for new projects.

I love what they've done with Go from my experience with it so far, they hit the target on a number of design fronts.

Re:A Clever Line of JavaScript by darthlord382 on Saturday December 02, 2017 @06:11AM (#15831409)
Too bad he didn’t follow his own advise in design of C++ (at least the simple and obvious part)
Re:A Clever Line of JavaScript by edejong on Saturday December 02, 2017 @11:35AM (#15832638)
The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague.

Dijkstra (1972) The Humble Programmer (EWD340).