expr-eval icon indicating copy to clipboard operation
expr-eval copied to clipboard

Tokens property not exposed on Expression TypeScript definition

Open philipAtHach opened this issue 5 years ago • 1 comments

Expression has a tokens property available that has not been added to the TypeScript definitions. Is that property intended to be private, or should it be added to the definition?

philipAtHach avatar Nov 07 '19 18:11 philipAtHach

The tokens property is visible mostly out of convenience since JavaScript doesn't have private properties, and as a debugging aid to view the output of the parser. There could be use cases for modifying it to do some advanced post-processing on expressions, but I'd consider that an advanced usage that's outside the scope of what's officially supported. It's also not a great name, since it's really the "compiled" instructions, not tokens. I think the name probably made sense at one point, but it's gone through a couple major refactorings and doesn't actually reflect what they are anymore.

So the short answer is, for now I'd consider it a private implementation detail, but that could change in the future, but probably with a different name.

silentmatt avatar Nov 07 '19 19:11 silentmatt