If you remove the typealias line (typealias TypeB SomeType), you can still
define an outer function that is, essentially, a constructor for SomeType.
The name won't also be an alias, of course.

Cheers,
   Kevin

On Sat, Feb 6, 2016 at 7:29 AM, Tim Holy <[email protected]> wrote:

> Int64, Float64, and Complex{Float32} are all effectively defined as
>
> immutable Number64
>     data::NTuple{8,UInt8}
> end
>
> Do you realize that you're proposing that we stop distinguishing between
> integers, floating-point numbers, and complex numbers? I don't think that
> would
> make many people very happy.
>
> The type itself is often used to encode differences in intended behavior,
> even
> when the raw information is the same.
>
> Best,
> --Tim
>
> On Saturday, February 06, 2016 07:13:30 AM Uri Patish wrote:
> > Indeed, typealias is not for defining a new types, but merly to associate
> > one type with other names. This is exactly the goal I'm trying to achieve
> > here, having a single type, and defining few outer constructors.
> >
> > In the example you present, you in fact create two types that are only
> > different in their name. I think this approach is wrong, if two type are
> > exactly alike, having the same structure and costing the same number of
> > bits, then their signature should be the same.
> >
> > What I was trying to achieve is to associate outer constructors with some
> > type, and aliasing those constructors.
> >
> > Uri
>
>

Reply via email to