# Default constructor for any type?

**URL:** <https://discourse.julialang.org/t/default-constructor-for-any-type/110546>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 21, 2024, 9:28pm UTC](https://discourse.julialang.org/t/default-constructor-for-any-type/110546 "2024-02-21T21:28:50Z")\
**Posts on this page:** 1\
**Showing post:** 27

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [February 23, 2024, 7:04am UTC](https://discourse.julialang.org/t/default-constructor-for-any-type/110546/27 "2024-02-23T07:04:41Z")

</div>

Are you sure that you can’t have a small union field?

> [@Successful Static Compilation of Julia Code for use in Production](https://discourse.julialang.org/t/successful-static-compilation-of-julia-code-for-use-in-production/79318/1):
>
> Another, inferior, option would be to instead `return Float64(s)` at the end. This makes the output type possible to infer and the compilation goes through, leaving an internal type instability.

From this write up, it looks like static compilation can handle some localized instability. You might have to type annotate the call sites potentially?

---

_[View the full topic](https://discourse.julialang.org/t/default-constructor-for-any-type/110546)._
