5 ms·
That's genious IMO. Making sure the amount of opening and closing parantheses is equal is annoying and unnecesary. It screams "trust me all good with the closi
by bboygravity 4y ago
That's genious IMO. Making sure the amount of opening and closing parantheses is equal is annoying and unnecesary.
It screams "trust me all good with the closing parantheses".
- andreareina 4y agoparedit and rainbow parens makes it a non-issue for me.
- paledot 4y agoI disagree. I would say when I get an unbalanced paren compiler error, it's more common for the omission to not be at the end of the line. Having the compiler silently swallow the error would lead to serious bugs very quickly.
- tonmoy 4y agoWhat if I wanted to copy that expression and use is as part of a different expression?
- NavinF 4y agoInteractive prompts already do that. Eg if you google "2+2)*3" it will correctly print "12". This effectively lets you append operations to an expression without editing both sides. On the other hand, auto closing parentheses in code is a terrible idea for obvious reasons. There are only like 7 languages used in industry and they all have excellent tooling that integrates with your editor to eliminate issues like this.
- ajuc 4y agoif ((v1.x()-v2.x())*(v1.x()-v2.x())+(v1.y()-v2.y())*(v1.y())-v2.y())+(v1.z()-v2.z())*(v1.z()-v2.z()) > distance*distance) { // collision } Would you like this to fail to compile? Or would you prefer it to silently return the wrong value?
- wstuartcl 4y agoif collisioncheck(v1,v2, distance) { // collision } where you have defined an actually readable equivalent inside of collisioncheck would be my prerogative... I also agree paren matching failures should error, but your example is NOT why.
- matthewmacleod 4y agoI'd prefer the compiler file an HR complaint against the author.