JuliaStats/Distributions.jl — pull request #119 by simonbyrne (2013-07-29 10:21:27+00:00)
Title: change Truncated to parametric type

This creates a `Truncated` parametric type, replacing the `@truncate` macro. This seems to be a more natural approach, as it doesn't require the user to define more types to use a truncated distribution, yet we are still able to exploit dispatch when special methods are available (as with the `Truncated{Normal}`).

The only downside with this approach is that the distribution no longer inherits from `ContinuousUnivariateDistribution`/`DiscreteUnivariateDistribution`. If this is a problem, we could define easily define more types in the hierarchy, e.g. `TruncatedContinuous`, `TruncatedDiscrete`, but I'm getting more skeptical as to the utility of this hierarchy: perhaps we would be better defining `iscontinuous` and `isdiscrete` methods? (I actually would be useful to define support types, but that's another issue).

The same approach could easily be extended to `Censored` and `CompoundPoisson` types as well: however these can both result in "mixed" distributions (i.e. part continuous and part discrete).