Skip to content

Commit fcfcde5

Browse files
nsicchaclaude
andcommitted
Add TODO for task-local storage alternative in expr_stack propagation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7c4c9b4 commit fcfcde5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/slic_stan/slic.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ canonical(x::CanonicalExprV{:ref}) = CanonicalExpr(:getindex, x.args...)
342342
canonical(x::CanonicalExprV{Symbol(".*")}) = CanonicalExpr(.*, x.args...)
343343
canonical(x::CanonicalExprV{Symbol("./")}) = CanonicalExpr(./, x.args...)
344344

345+
# TODO: task-local storage is used here to propagate _expr_stack/_current_lnn through
346+
# @deffun calls, which rebuild `info` from scratch. Cleaner alternatives:
347+
# - Thread info through stan_expr (invasive: changes signature everywhere + codegen)
348+
# - Carry refs as CanonicalExpr kwargs (requires codegen changes in functions.jl)
345349
_get_expr_stack(info) = something(_expr_stack(info), get(task_local_storage(), :_slic_expr_stack, nothing), Some(nothing))
346350
_get_lnn_ref(info) = something(_current_lnn(info), get(task_local_storage(), :_slic_current_lnn, nothing), Some(nothing))
347351
_get_lnn(info) = (lnn = _get_lnn_ref(info); lnn isa Ref ? lnn[] : nothing)

0 commit comments

Comments
 (0)