erik-kallen/SaltarelleCompiler — pull request #148 by ProdigySim (2013-02-25 02:23:42+00:00)
Title: Adds interfaces IReadOnlyCollection and IReadOnlyDictionary (Issue #140)

Some notes:

1. I chose to make ```IDictionary``` and ```ICollection``` inherit from their ReadOnly counterparts. The official .NET implementation doesn't seem to do this, but I couldn't see any reason why. This can be fairly easily undone if there's a good reason for it.
2. I changed the IDictionary ```add``` and ```remove``` to have script names ```dictAdd``` and ```dictRemove```. I experimented briefly with keeping the names the same and doing a javascript-style parsing of the available arguments, but I feel like it was less clean and mostly pointless--not to mention possibly bug-creating. These names can be easily changed if desired.
3. To implement ```ICollection<...>.Remove()``` and ```ICollection<...>.Contains()``` I utilized ```ss_EqualityComparer.def```, in hopes that this would be similar to [Mono's implementation](https://github.com/mono/mono/blob/master/mcs/class/corlib/System.Collections.Generic/Dictionary.cs#L495).
4. In ```ss_Dictionary$2._remove()``` I passed in the "checkValue" parameter explicitly, just in case a user decided to store ```Script.Undefined``` in a Dictionary. This is probably made moot by the EqualityComparer checking ```ss.isValue()```, but I didn't want to take any chances.
5. The built-in array type does not support ```IReadOnlyCollection```. This would require NRefactory changes, which I attempted to make but failed badly. I've written tests for these but left them commented out.
6. I wrote a lot of tests and I don't have much frame of reference for what a good test should be like, so I apologize if they're too verbose, weak, redundant, etc.