google / starlark-go

Starlark in Go: the Starlark configuration language, implemented in Go
BSD 3-Clause "New" or "Revised" License
2.26k stars 204 forks source link

syntax: parameterize API over FileOptions, avoid globals #477

Closed adonovan closed 10 months ago

adonovan commented 1 year ago

This change eliminates the need for client applications to set global variables to control dialect options, as globals are error-prone and concurrency hostile.

All relevant API functions Foo now have a variant FooOptions that takes an explicit FileOptions; the original function accesses the legacy options by reading the global variables.

Fixes #435

adonovan commented 1 year ago

Thanks, Jay.

adonovan commented 10 months ago

Sorry for the slow review. It's been a really busy summer, and this slipped off my radar.

No worries! Between furious gopls work and now a lengthy vacation I haven't been spending much time thinking about Starlark. (Or the other matter, for that matter.)

Thanks for reviews, as always.