Could you explain how your second example is cleaner? All I see is that it's 
longer; the rest is merely a matter of taste.
JavaScript's syntax was, amongst others, heavily influenced by C-family 
languages (which went for `&&` and `||` as well as `&` and `|`).

Next, I think it's confusing that, although we're calling it "bitwise and" and 
"bitwise or", we would only be able to write `and` or `or` in a logical 
context; this choice is entirely arbitrary. Bitwise operators would still need 
to be `&` and `|` since there's no way to tell what your intent is just from 
the syntax.

IMHO, the current operators `&&`, `&`, `||` ,`|` are the cleanest 
implementation of `and` and `or` that I could think of.

On Dienstag, 24. Mai 2016 21:14:59 CEST Francis Clavette wrote:
> Hi, 
> I’d like to be able to use AND for && and OR for || in conditional statements 
> in a future version of ECMAScript. It’s a feature I’ve always been wanting 
> since transitioning from PHP. It’s also much cleaner : 
> 
> if ($scope.newSourceModal.isShown() && $scope.newsource.type == "book" && 
> (!$scope.insertingFromScan || $scope.ok))
> 
> ==============
> 
> if ($scope.newSourceModal.isShown() AND $scope.newsource.type == "book" AND 
> (!$scope.insertingFromScan OR $scope.ok))
> 
> 
> Francis
> 
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to