# Best practices for defining inner constructors for parametric types

**URL:** <https://discourse.julialang.org/t/best-practices-for-defining-inner-constructors-for-parametric-types/106494>\
**Category:** General Usage\
**Tags:** parametric-types, constructors, best-practices\
**Created:** [November 20, 2023, 10:21pm UTC](https://discourse.julialang.org/t/best-practices-for-defining-inner-constructors-for-parametric-types/106494 "2023-11-20T22:21:20Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [November 20, 2023, 11:31pm UTC](https://discourse.julialang.org/t/best-practices-for-defining-inner-constructors-for-parametric-types/106494/4 "2023-11-20T23:31:57Z")

</div>

In Julia the convention ([sadly](https://github.com/JuliaLang/julia/issues/42372) not enforced by the compiler) is that, for any type `S` (either abstract or concrete) and any `args`, when calling `S(args...)`, if the call returns it should return a value that `isa S`. So the concrete type constructor (`MyType{T}`) is, in a sense, more basic than the abstract type constructor (`MyType`). So IMO the former option in your question is much preferable than the latter.

Furthermore, the former option may make it easier for the programmer to be easy on the compiler (regarding type inference) when necessary, although this would rarely matter.

---

_[View the full topic](https://discourse.julialang.org/t/best-practices-for-defining-inner-constructors-for-parametric-types/106494)._
