(maint) undef not correctly handled in type calculator

There were several problems wrt. undef in the implementation of handling undef in the type calculator (aka
the type system). Some of this was due to faulty tests (never called expect/should) and problems went unnoticed.

While making the handling of undef sane it was also needed to offer an Optional type, and to handle the
kind of undefinedness that occurs when an array or hash is empty. (This was also generalized to handle String which
had non-meaningful behavior allowing users to parameterize a String with a set of string value (which is only meaningful to the type inference)).