News for hackers. Stuff that matters.
Re:How to store your app's entire state in the url by reaperducer on Monday January 09, 2023 @08:40PM (#34319198)
we used to joke about LISP source code contains mostly brackets.

There was a programming language in the 1970's called SAM76 that didn't care how many closing parentheses you had, as long as it was more than the number of opening parentheses.

So, something like this was perfectly valid:

  a(1+r(em(2)))))))))))))))))))
Re:How to store your app's entire state in the url by bboygravity on Monday January 09, 2023 @10:15PM (#34320066)
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".

Re:How to store your app's entire state in the url by andreareina on Tuesday January 10, 2023 @12:12AM (#34320798)
paredit and rainbow parens makes it a non-issue for me.
Re:How to store your app's entire state in the url by paledot on Tuesday January 10, 2023 @12:18AM (#34320829)
I 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.
Re:How to store your app's entire state in the url by tonmoy on Tuesday January 10, 2023 @12:55AM (#34321041)
What if I wanted to copy that expression and use is as part of a different expression?
Re:How to store your app's entire state in the url by NavinF on Tuesday January 10, 2023 @03:02AM (#34321854)
Interactive 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.

Re:How to store your app's entire state in the url by ajuc on Tuesday January 10, 2023 @03:16AM (#34321935)

    if ((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?
Re:How to store your app's entire state in the url by matthewmacleod on Tuesday January 10, 2023 @04:18AM (#34322286)
I'd prefer the compiler file an HR complaint against the author.
Re:How to store your app's entire state in the url by wstuartcl on Wednesday January 11, 2023 @12:25PM (#34341203)
if 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.

Re:How to store your app's entire state in the url by lIl-IIIl on Tuesday January 10, 2023 @02:24AM (#34321606)
Relevant xkcd: https://xkcd.com/859