Closed ghost closed 3 years ago
Is there a way to achieve my goal of getting a thread local using dot syntax only?
No. The field selection operation is intended to be an operation on a data structure "at rest", whereas a function call is a computation that takes place within the context of a particular thread. Another implementation of Starlark could have made a different choice, but that's the way this implementation was designed.
(I am not a big believer in the so-called "Uniform Access Principle", which says fields and methods should be interchangeable. I think it's an important pragmatic readability benefit that a field access is just a field access, whereas a function call can do basically anything.)
Is there a forum for asking questions about Starlark, or is this issue tracker the right place?
There is a mailing list here: https://groups.google.com/g/starlark-go but it is very low-traffic.
There is also a Starlark channel in the Gopher Slack, but it is also very low-traffic.
Uh oh, the Lua proponents on my team are going to use the () against me. Thankfully, I have correct error positions in my favor!
Thank you for the help.
My application executes a number of jobs concurrently. I create a new starlark.Thread for each of those jobs.
I want to provide information about the current job through a pre-declared variable so the developer does not need to pass the job through layers of functions. I want to enable something like this:
where
job
is is a pre-declared variable andcurrent
is taken from a thread local. This does not work because the Attr method does not have a thread argument. I need to insert a call to get the access the thread:Is there a way to achieve my goal of getting a thread local using dot syntax only?
Is there a forum for asking questions about Starlark, or is this issue tracker the right place?