2
donkulator
100d

Someone should do away with parentheses, just like python did away with braces.

Comments
  • 0
    What's 'do away'?
  • 1
    @netikras to get rid of something
  • 1
    Swift got rid of many paranthesis like in control flows:

    if x < 10 {
    //…
    }

    for index in 0…10 {
    //…
    }
  • 0
    Why and when,sure there might be some that are technically redundant but they might serve a contextual purpose to distinguish between different things.

    And removing something that already exists take careful planning since you do not make breaking changes unless there is a gain outweighing the problems with the change.
  • 0
  • 0
    @netikras So an expression like (a+1)*(b+2) would become a+1 * b+2
  • 1
    Python's syntax tree is so fucked because of this bizarre choice that you
    - can't have locals in lambdas
    - can't break an expression into multiple lines without parenthesizing it.

    To reiterate, these aren't stylistic choices, they're consequences of Python relying on what should be circumstantial information to figure out where the braces and semis would be.
  • 0
    By the way, the consequence of the above two is that

    lambda x: (
    .. function body
    )

    is exceedingly common in python code. It still can't contain locals but at least this is allowed to contain any number of operations.
  • 0
    @donkulator

    And those two expressions aren't the same, so, yeah, parentheses stay.
  • 0
    @CoreFusionX They are the same if you apply the operators in order of how many whitespace characters they are surrounded by.
Add Comment