Comment by almostgotcaught

2 days ago

you can't do this consistently across all cases without compiler assistance (see https://doc.rust-lang.org/book/ch19-03-pattern-syntax.html or https://peps.python.org/pep-0636/#matching-builtin-classes linked below).

perfect is enemy of good imo, dict destructuring is so valuable that I'm willing to bend some rules / add some rules to make it possible. can't we just copy whatever JS does?

  • > perfect is enemy of good imo

    You can't land a language feature that only sometimes works - that's absolutely horrid UX.

    > can't we just copy whatever JS does?

    I wasn't aware that js does this and I don't know it's implemented. So maybe I should retract my claim about compiler assistance.