# Should Generators finally be given eltype

**URL:** <https://discourse.julialang.org/t/should-generators-finally-be-given-eltype/20507>\
**Category:** Internals & Design\
**Created:** [February 6, 2019, 2:44pm UTC](https://discourse.julialang.org/t/should-generators-finally-be-given-eltype/20507 "2019-02-06T14:44:43Z")\
**Posts on this page:** 1\
**Showing post:** 15

<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:** [February 7, 2019, 3:44pm UTC](https://discourse.julialang.org/t/should-generators-finally-be-given-eltype/20507/15 "2019-02-07T15:44:45Z")

</div>

> [@yuyichao](#):
>
> But `Base.return_type` **is** the building block? It should be the main function needed for that.

No, the building block is an interface for a collection that can

1. either store a new value (eg `<: eltype`),
2. or allocate a new collection that can.

The caller determines if widening is needed, and calls itself accordingly. Just review [“take 2” here](https://discourse.julialang.org/t/functional-implementation-of-collect/15177/2), it is really short.

---

_[View the full topic](https://discourse.julialang.org/t/should-generators-finally-be-given-eltype/20507)._
