# Constant type semantics

**URL:** <https://discourse.julialang.org/t/constant-type-semantics/53028>\
**Category:** New to Julia\
**Created:** [January 8, 2021, 7:58am UTC](https://discourse.julialang.org/t/constant-type-semantics/53028 "2021-01-08T07:58:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akalinin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/akalinin/32/20163_2.png) [@akalinin](https://discourse.julialang.org/u/akalinin)\
**Post date:** [January 8, 2021, 7:58am UTC](https://discourse.julialang.org/t/constant-type-semantics/53028/1 "2021-01-08T07:58:55Z")

</div>

Consider we have some abstract type

```julia
abstract type Point{T, N} end

```

What is the main difference between

```julia
Point3{T} = Point{T, 3}

```

and

```julia
const Point3{T} = Point{T, 3}

```

What is the `const` modificator meaning related to the type declaration? I did not find exact explanation in the documentation.

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [January 8, 2021, 8:13am UTC](https://discourse.julialang.org/t/constant-type-semantics/53028/2 "2021-01-08T08:13:27Z")

</div>

I think in this instance they are equivalent. consider

```julia
julia> Point3{T} = Point{T, 3}
Point{T,3} where T

julia> Point3 = 11
ERROR: invalid redefinition of constant Point3
Stacktrace:
 [1] top-level scope at REPL[25]:1

```

thus `Point3` is implicitly made a `const`. However, if you don’t have type parameters, then you should use the const:

```julia
julia> Point3I = Point{Int, 3}
Point{Int64,3}

julia> Point3I = 11
11

```

as then the variable is not automatically marked as `const`, and thus if you use it inside functions it will lead to type-unstable code.

To make the notation consistent, I would then also use `const` in the first example, even though it is not needed.

---

<div class="post-metadata">

**Author:** ![akalinin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/akalinin/32/20163_2.png) [@akalinin](https://discourse.julialang.org/u/akalinin)\
**Post date:** [January 8, 2021, 9:41am UTC](https://discourse.julialang.org/t/constant-type-semantics/53028/3 "2021-01-08T09:41:32Z")

</div>

Thank you for the explanation!
