I was just trying to understand what box is for. IIUC it’s a way of saving the costs of allocation & GC across function calls by passing what’s essentially a reference to a value rather than the value itself. But, if that’s so, then I don’t understand the benefit of putting a Boolean or symbol in a box, since they’re so tiny to begin with.
Oh no, I can’t mess with perfection.
I was just trying to understand what `box` is for. IIUC it’s a way of saving the costs of allocation & GC across function calls by passing what’s essentially a reference to a value rather than the value itself. But, if that’s so, then I don’t understand the benefit of putting a Boolean or symbol in a box, since they’re so tiny to begin with.
I think the compiler puts set!'d variables into a box (or the moral equivalent of a box). If that's true, then I don't think there's performance savings either way.
(This is based on what I remember from talking to Leif)
To me, a box is for saying "this variable is going to be mutated".
I think the compiler puts `set!`'d variables into a box (or the moral equivalent of a box). If that's true, then I don't think there's performance savings either way.
(This is based on what I remember from talking to Leif)
To me, a box is for saying "this variable is going to be mutated".
Oops, this comment shoudn't be here
BTW, what is the reason to use
box
andset!-box
to mutateprev-datum
rather than just mutating the variable itself?I'm prejudiced against
set!
. I likebox
to communicate my intentions.But this is your code so you should do what you want.
Oh no, I can’t mess with perfection.
I was just trying to understand what
box
is for. IIUC it’s a way of saving the costs of allocation & GC across function calls by passing what’s essentially a reference to a value rather than the value itself. But, if that’s so, then I don’t understand the benefit of putting a Boolean or symbol in a box, since they’re so tiny to begin with.I think the compiler puts
set!
'd variables into a box (or the moral equivalent of a box). If that's true, then I don't think there's performance savings either way.(This is based on what I remember from talking to Leif)
To me, a box is for saying "this variable is going to be mutated".