News for hackers. Stuff that matters.
Re:PHP 7.4 by johnchristopher on Thursday November 28, 2019 @10:01AM (#21657775)
I am diving back into node lately and it's really annoying to decipher the async and promises styles that are peppered with different anonymous function styles.

I too stick to the most explicit version (function($foo)).

It's the same for command line arguments, I have an easier time remembering words (--preserve-permissions for instancem --volume, etc.) than letters if I don't use the interface enough.

Re:PHP 7.4 by Cthulhu_ on Thursday November 28, 2019 @10:05AM (#21657800)
This is a problem in a lot of programming languages nowadays; they borrow features and syntax from other languages without those new features superseding others, and without providing a mechanism to force one syntax over the other.

So that's why we now have half-assed OOP in Javascript, we have Scala which is basically all programming languages ever, etc. Meanwhile, Go is still fighting a lot of requests to add language features, knowing full well the complexity added to the compiler (and more importantly the cognitive overhead for developers).

Re:PHP 7.4 by oaiey on Thursday November 28, 2019 @12:53PM (#21659059)
The art of language design is staying true with its own established patterns. C# fights this battle with primary constructors or combined patterns.
Re:PHP 7.4 by earthboundkid on Thursday November 28, 2019 @12:25PM (#21658889)
That’s a weird choice. Arrow functions in JS don’t redefine ‘this’ like regular functions, so if you don’t use them, you waste time working around the redefinition.
Re:PHP 7.4 by hombre_fatal on Thursday November 28, 2019 @02:23PM (#21659594)
Also, if you default to `() => ...` for anonymous functions, then you can reserve anonymous `function() { ... }` for the rare times you actually want peculiar `this`. Same reason it's nice to default to `const` so that `let` becomes a signal for the bonus feature of reassignment.
Re:PHP 7.4 by johnchristopher on Monday December 02, 2019 @02:58AM (#21680669)
> Same reason it's nice to default to `const` so that `let` becomes a signal for the bonus feature of reassignment.

Code documentation should be clear and concise, not to be deciphered through the code author's take on the meta meaning of reserved words.

Re:PHP 7.4 by earthboundkid on Friday November 29, 2019 @10:29PM (#21668341)
No, const inside of a function is a complete waste of time. There has never been a bug that would be prevented by const inside a function.