On Mon, 2016-02-08 at 11:29, Uri Patish <[email protected]> wrote:
> immutable SomeType
>   value::Int
> end
>
> typeref SomePositiveType SomeType
> function SomePositiveType(value::Int)
>   if value < 0
>     error("value must be positive")
>   end
>   SomeType(value)
> end
>
> typeref SomeNegativeType SomeType
> function SomeNegativeType(value::Int)
>   if value > 0
>     error("value must be negative")
>   end
>   SomeType(value)
> end
>
> If type references were an option, following the last discussion, then my
> answer to Tim and Stefan would be yes. Int, UInt, and Float64 should all be
> type references to a more basic type, maybe Number64.

If I understand you correctly, being able to make typeref's has been
discussed, maybe of interest:
https://groups.google.com/d/msg/julia-dev/2tMXJbggKO8/RQ2H_55VLOkJ
https://groups.google.com/d/msg/julia-dev/v8B1tI_NB5E/tk98D0iKopYJ

Reply via email to