polterguy / lizzie

A script language for .Net and the CLR
https://ainiro.io/
MIT License
190 stars 27 forks source link

Questions about Binder.RemoveKey #41

Closed SapphireBrand closed 5 years ago

SapphireBrand commented 5 years ago

The header comment to Binder.RemoveKey says, "You can only remove elements if you have 'pushed' the stack at least once", but the code allows you to remove elements from the static binder if you have not pushed the stack.

Also, just to check: the behavior of IDictionary.Remove() is to do nothing if the key is not present. That behavior is fine with me, but I thought I should confirm that you did not intend to throw.

polterguy commented 5 years ago

Hmm, the RemoveKey method is only used in the each function (Each method), and only used to create an "iterator", allowing it to de-reference the currently iterated element inside of the each lambda block. Not sure how relevant this is, though obviously the comments for the method should be changed, and I have now changed the comment in the GIT repository.

I will create a new release, hopefully during the weekend, with the changes to its comments, plus some other (much more crucial changes).