-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
task_local_storage() is un-Julian #14135
Comments
This is a good idea. I only wonder if it's ever useful to get a reference to the actual storage of a specific task. Would we do that via |
@JeffBezanson, in all the cases that I can find that currently call |
👍, I experienced this when I redeveloped Base.Test and it felt like very clunky |
unlikely to be refactored right now |
Discussed during triage and decided that having a special array type seems like a nice design. Removing decision, adding up for grabs. |
Could we just express this with indexing into type objects? E.g. |
@StefanKarpinski, you mean into the |
No, I meant the task object, but the task type could work too. The task object would allow accessing a tasks storage externally. |
So you would do |
I'd be a little worried that that would prevent us from adding other operations on Tasks, e.g. we used to have task iteration ( |
It's not entirely kosher but you could distinguish indexing into a task with integers versus symbols... |
Another thought: have a |
This seems non-breaking. Worst case we have to keep the old function as an alias. Propose to remove from milestone. |
Seems like it would be much more idiomatic to have a global variable
TASK_LOCAL_STORAGE::Task_Local_Storage
withget
,getindex
, andsetindex!
methods forTask_Local_Storage <: Associative{Any,Any}
so that you could just doTASK_LOCAL_STORAGE[:foo] = bar
etcetera.I noticed this because there is no documented analog of
get(TASK_LOCAL_STORAGE, key, default)
fortask_local_storage()
... I expectedtask_local_storage(key, default)
to do this and was surprised that it acted as assignment (without!
). There is the undocumentedget(task_local_storage(), key, default)
, but it occurred to me that just havingTASK_LOCAL_STORAGE
act like aDict
would be much cleaner and clearer.The text was updated successfully, but these errors were encountered: