Open pdeffebach opened 3 years ago
Well, what I really would like is some way to send variables to the outer scope easily, with something like @assign intermediate = _
. And I don't think this is really feasible with everything in a let
block.
yeah I guess I could actually do that. I thought I wouldn't because of all the intermediary variables, but I guess they won't interfere much? I'm not sure if there's a speed difference at global scope because the intermediary variables would be non-const. I guess one could make them const as well though
I was wrong about AddToField.jl working with let
though. I will fix AddToField and then apply the same strategy to a PR here.
Aren't all the intermediate variables in @chain
anonymous variables? Does that make things better?
yes they are, I just chose let in the beginning to have no trace at all of these variables. But I do think exporting a variable once in a while or saving an intermediate step can be useful
I think it's not uncommon to want things created in
@aside
blocks to be visible in the outer scope of a@chain
block.If we make the default "block" for
@chain
to be just abegin ... end
block without introducing a new scope, the user can make the same behavior withThis is something I considered in AddToField.jl and settled on
begin ... end
.