# Is julia strongly checked(typed)?

**URL:** <https://discourse.julialang.org/t/is-julia-strongly-checked-typed/12990>\
**Category:** General Usage\
**Created:** [August 7, 2018, 1:33pm UTC](https://discourse.julialang.org/t/is-julia-strongly-checked-typed/12990 "2018-08-07T13:33:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![songtianyi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/songtianyi/32/4885_2.png) [@songtianyi](https://discourse.julialang.org/u/songtianyi)\
**Post date:** [August 7, 2018, 1:33pm UTC](https://discourse.julialang.org/t/is-julia-strongly-checked-typed/12990/1 "2018-08-07T13:33:17Z")

</div>

Is julia a strongly checked language, which means the type system prevent the untrapped error as more as possible?  
For example, C/C++ do allow pointer arithmetic operations, so they are not.  
If it is, what julia did to make it possible.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 7, 2018, 2:14pm UTC](https://discourse.julialang.org/t/is-julia-strongly-checked-typed/12990/2 "2018-08-07T14:14:55Z")

</div>

No, Julia is a dynamic language.

---

<div class="post-metadata">

**Author:** ![jameson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jameson/32/23_2.png) [@jameson](https://discourse.julialang.org/u/jameson)\
**Post date:** [August 7, 2018, 4:02pm UTC](https://discourse.julialang.org/t/is-julia-strongly-checked-typed/12990/3 "2018-08-07T16:02:11Z")

</div>

> [@kristoffer.carlsson](#):
>
> No, Julia is a dynamic language.

That’s largely unrelated. For comparison, Lisp is a strongly typed, dynamic language, while C is a more weakly typed static language.

Yes, Julia is a strongly typed language: it does not allow pointer arithmetic or type punning. (I’m too lazy to find a real reference, so I’ll just use [Strong and weak typing - Wikipedia](https://en.wikipedia.org/wiki/Strong_and_weak_typing))

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 7, 2018, 4:04pm UTC](https://discourse.julialang.org/t/is-julia-strongly-checked-typed/12990/4 "2018-08-07T16:04:38Z")

</div>

Well,

> Note that some of these definitions are contradictory, others are merely conceptually independent, and still others are special cases (with additional constraints) of other, more “liberal” (less strong) definitions. Because of the wide divergence among these definitions, it is possible to defend claims about most programming languages that they are either strongly or weakly typed.

But ok.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 7, 2018, 4:47pm UTC](https://discourse.julialang.org/t/is-julia-strongly-checked-typed/12990/5 "2018-08-07T16:47:05Z")

</div>

> [@jameson](#):
>
> it does not allow pointer arithmetic or type punning.

Educate me why this is not type punning

```julia
julia> f(x::Vector{Int}) = x
f (generic function with 1 method)

julia> v = rand(Int, 3, 1); # Matrix

julia> f(vec(v))
3-element Array{Int64,1}:
  4008100996524184079
 -3279737924264939174
  1302702468106043500

```

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [August 8, 2018, 1:18am UTC](https://discourse.julialang.org/t/is-julia-strongly-checked-typed/12990/6 "2018-08-08T01:18:30Z")

</div>

Ah, no need to put Julia in a `Core.Box`.

---

<div class="post-metadata">

**Author:** ![jameson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jameson/32/23_2.png) [@jameson](https://discourse.julialang.org/u/jameson)\
**Post date:** [August 8, 2018, 10:06am UTC](https://discourse.julialang.org/t/is-julia-strongly-checked-typed/12990/7 "2018-08-08T10:06:00Z")

</div>

👍

---

<div class="post-metadata">

**Author:** ![songtianyi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/songtianyi/32/4885_2.png) [@songtianyi](https://discourse.julialang.org/u/songtianyi)\
**Post date:** [August 8, 2018, 5:08pm UTC](https://discourse.julialang.org/t/is-julia-strongly-checked-typed/12990/8 "2018-08-08T17:08:36Z")

</div>

> [@kristoffer.carlsson](#):
>
> punning

Thanks.  
But i don’t think they proved julia is strongly typed. In my limited knowledge, there are serval way to distinguish it

- implicit type conversions allowed
- pointer arithmetic
- untagged unions(type punning?)
- type of variable can be changed

If a language has above features, it should be weakly typed.
