# Why does arrayref throw?

**URL:** <https://discourse.julialang.org/t/why-does-arrayref-throw/104283>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [September 26, 2023, 9:13pm UTC](https://discourse.julialang.org/t/why-does-arrayref-throw/104283 "2023-09-26T21:13:03Z")\
**Posts on this page:** 1\
**Showing post:** 20

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [September 28, 2023, 10:41pm UTC](https://discourse.julialang.org/t/why-does-arrayref-throw/104283/20 "2023-09-28T22:41:21Z")

</div>

> [@StefanKarpinski](#):
>
> > [@tmpo](#):
> >
> > Conversely, if accessing an undef element is “undefined behavior”,
> 
> It isn’t undefined behavior, it’s fully defined.

This came up before, with (due to your statement) now conflicting interpretations:

> [@Is accessing an \`undef\` array undefined behavior?](https://discourse.julialang.org/t/is-accessing-an-undef-array-undefined-behavior/101899/22):
>
> Yes, though probably not the kind that we’d exploit for optimization. We’d likely change the behavior of it to be defined if the compiler got to the point of being strong enough for this to be a problem (because then it could likely also optimize away the cases where it’s currently slow).

Which is it?

To be clear, I don’t think the term “undefined behavior” is particularly helpful in Julia, because we don’t have a defining standard like C that we could be violating.

---

_[View the full topic](https://discourse.julialang.org/t/why-does-arrayref-throw/104283)._
