# Many or few constructor signatures?

**URL:** <https://discourse.julialang.org/t/many-or-few-constructor-signatures/12301>\
**Category:** Internals & Design\
**Created:** [July 10, 2018, 7:03pm UTC](https://discourse.julialang.org/t/many-or-few-constructor-signatures/12301 "2018-07-10T19:03:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [July 10, 2018, 7:03pm UTC](https://discourse.julialang.org/t/many-or-few-constructor-signatures/12301/1 "2018-07-10T19:03:20Z")

</div>

Is there a best practice with respect to construction, now that construction is separate from conversion and seems to be more taxonomically essential? Some have recommended that a family of constructors for a user-defined struct be as thin as is reasonable. Others prefer the direct action that obtains with construction over multi-signatures.

---

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [July 11, 2018, 1:42am UTC](https://discourse.julialang.org/t/many-or-few-constructor-signatures/12301/3 "2018-07-11T01:42:44Z")

</div>

I have two, related, questions regarding best perspective to bring in polyphonic construction using Julia’s `constructor_of_this_is_its_own_name` multidispatching realization. The first is an attempt to clarify the river that flows through our most modern construct & convert dyadic. The second is a grasp at best practice in the design, care & feeding of constructors we etch.

My current understanding is that this is the grist with which Julia mills artistry from effortstry: `construction` manufactures and multi-realizes while `conversion` serves as the enactor of `promotion` and provides the provable in dataform adaption.

When deriving a close-kint family of constructors or sculpting relatably given constructions, some essential guidance is to come from the way Julia `just works` and `improves our workpersonhood`. I am comfortable with that … please allow your insight to hone the way we confer the best practices to others.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [July 11, 2018, 7:10am UTC](https://discourse.julialang.org/t/many-or-few-constructor-signatures/12301/4 "2018-07-11T07:10:27Z")

</div>

This may not be new (since you participated in the topic), but

> [@Recommended style for conversion vs. constructors in v0.7](https://discourse.julialang.org/t/recommended-style-for-conversion-vs-constructors-in-v0-7/11561):
>
> I’ve been upgrading a few packages to v0.7, and one of the biggest sources of deprecations is the removal of the default constructor-\>convert fallback. For those unfamiliar, previously if you had: struct T ... end Base.convert(::Type{T}, x::Int) = (construct a new T from an Int) then you you could call T(1) and, if there was not constructor matching (::Int), then convert(T, 1) would automatically be called for you. That was convenient but also kind of muddied the distinction between convers…

has a lot of good advice for constructors.

I would not worry about too many _outer_ constructor methods _per se_, eg `DataFrames.DataFrame` has 16 outer methods (and 1 inner constructor).

However, if you need more than a few (ideally 1) _inner_ constructors (eg for validation), you may be doing something wrong.

---

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [July 11, 2018, 7:38am UTC](https://discourse.julialang.org/t/many-or-few-constructor-signatures/12301/5 "2018-07-11T07:38:25Z")

</div>

Thanks for referencing me to me [Julia really is grand].
