JuliaLang/julia — pull request #7172 by timholy (2014-06-08 04:36:42+00:00)
Title: Allow usage of specific immutable types as parameters

The proximal motivation behind this is to be able to support stuff like `sqrt(2Meter)`, where `Meter` is from SIUnits. This doesn't easily work now because SIUnits encodes the units as integer type parameters, and currently Rationals cannot be used as type parameters. One could do it now using a "cheat" like this:
```
immutable RationalP{Num,Denom}; end
```
and then defining quantities in terms of `RationalP{1,2}`. However, I wondered if it would be better just to use plain Rationals.

Consequently, this implements a framework for "registering" specific types as being acceptable template parameters. I would be pretty surprised if there weren't some serious problems with this, but there's no better way to find out than by submitting it.