dustjs icon indicating copy to clipboard operation
dustjs copied to clipboard

[discussion] Access the Context's index and length

Open sethkinast opened this issue 10 years ago • 2 comments

( instead of pushing our own copies onto the stack )

I think anything that manually manipulates the stack directly is a smell. We already have these properties available as context.stack.index and context.stack.of. It doesn't seem to make sense to directly reach into the stack's head and manually set them there.

Instead, we can short-circuit get in these cases.

This also has the side effect of not polluting someone's context.current() with something they didn't expect to be there.

I would just like to get some discussion on this one, I'm not convinced it's correct yet.

sethkinast avatar Apr 30 '15 15:04 sethkinast

Manually setting $idx and $len to undefined after is especially distasteful to me.

sethkinast avatar Apr 30 '15 15:04 sethkinast

I would like to get something like this in for Dust@3 in which I don't plan on supporting IE8. Shall we make this a getter?

sethkinast avatar Sep 13 '16 02:09 sethkinast