Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Replacing a TokenizedString #677

Open
markfinal opened this issue Jan 2, 2020 · 1 comment
Open

Replacing a TokenizedString #677

markfinal opened this issue Jan 2, 2020 · 1 comment
Assignees

Comments

@markfinal
Copy link
Owner

If you do the naive thing of

this.Macros["SomeMacro"] = this.CreateTokenizedString(...)

then the behaviour is not what you expect.
I believe this is because the original Macro TokenizedString is in the cache, and other TS's might be referencing it still, keeping it alive.

You can get the desired behaviour with

this.Macros["SomeMacro"].Set(...)

but you have to remember to do that.

There needs to be an improved mechanism for being able to replace an existing TS.

@markfinal markfinal self-assigned this Jan 2, 2020
@markfinal
Copy link
Owner Author

For macros, I think the solution is to eliminate the indexer setter.
So you can only ever add a macro through a function, e.g. this.AddMacro(key,value).
But you can get it through the indexer.

markfinal added a commit that referenced this issue Jan 4, 2020
…it's no longer ambiguous when a macro string is replaced
markfinal added a commit that referenced this issue Jan 4, 2020
…ates, so have to go extra distance to disconnect duplicates
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant