On Fri, Oct 30, 2015 at 8:29 AM, FANG Colin <colinf...@gmail.com> wrote:
> I have got the same confusion. Any ideas?
>
> I have even seen usage of A = T (no const)
> (http://docs.julialang.org/en/release-0.4/manual/types/#type-unions), is it
> supposed to be bad (slow) because it is a global variable?
>

no const will have performance issue since it's a global.
`const A = T` is what `typealias A T` lowered to when it doesn't have
type parameters. In this case, it's just a matter of style. Being
consistent within a file is probably better but you can pick whichever
you prefer.

>
>
> On Thursday, November 6, 2014 at 3:38:41 PM UTC, Steven G. Johnson wrote:
>>
>> Given a type T, what is the difference in practice between
>>      typealias A T
>> and
>>      const A = T
>> ?
>>
>> There seems to be some disagreement over which one to use (e.g.
>> https://github.com/JuliaLang/Compat.jl/commit/8211e38ac7d8448298a2bb3ab36d6f0b6398b577).
>>
>> My impression is that there is no difference, and that the only advantage
>> of a typealias is that it can be parameterized.  Is that right?
>>
>> If they are equivalent, what is the Julian style?  Even in Julia Base it
>> doesn't seem to be entirely consistent.

Reply via email to