points by bvrmn 1 year ago

Context managers: exist.

JS: drop but we couldn't occupy a possibly taken name, Symbol for the win!

It's hilariously awkward.

masklinn 1 year ago

> JS: drop but we couldn't occupy a possibly taken name, Symbol for the win!

You're about a decade late to the party?

That is the entire point of symbols and "well known symbols", and why they were introduced back in ES6.

  • bvrmn 1 year ago

    And I didn't use it because there was no need.

    Resource scoping is important feature. Context managers (in python) are literally bread and butter for everyday tasks.

    It's awkward not because of Symbol, it introduces new syntax tied to existing implicit scopes. It's kinda fragile based on Go experience. Explicit scoping is a way more predictable.

demarq 1 year ago

nah, Symbol has been traits for javascript for quite a while eg. Symbol.iterator

It's the "dispose" part where the new name is decided.

  • rounce 1 year ago

    Traits in the way that a roller-skate is a car.