Toolshed’s type system is, for the most part that of C#’s. Toolshed adds some additional type rules for the convenience of both users and developers.
Toolshed will automatically cast a lone value into a list containing only that value, if necessary. This lets you apply enumerable only commands to single values if necessary.
This isn’t technically toolshed specific, but it’s useful to know that one can use a
Dictionary<K,V>, etc, as the input to any command taking an enumerable.
When assigning an enumerable to a variable, Toolshed will automatically coerce it into a list to fully evaluate it and allow you to reuse it.
Within C#, using an
IEnumerable<T> more than once is disallowed, hence this coersion.
Toolshed will refuse to do complex assignability checks for types with more than one co-variant or contra-variant argument, as to avoid combinatorial explosion from searching all possible types to use.
Toolshed will, for any type implementing
IAsType<T>, consider T to be a valid implicit cast for that type.
For example, if
Foo : IAsType<Bar>, Toolshed will use the IAsType implementation to obtain Bar from Foo if it’d allow it to successfully typecheck a command run.