# Here's a fun thing

**URL:** https://discourse.julialang.org/t/heres-a-fun-thing/106556
**Category:** General Usage
**Created:** [November 22, 2023, 2:24am UTC](https://discourse.julialang.org/t/heres-a-fun-thing/106556 "2023-11-22T02:24:52Z")
**Posts on this page:** 1
**Showing post:** 17

<div class="post-metadata">

### Author: ![rocco\_sprmnt21](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocco_sprmnt21/32/20127_2.png) [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)
#### Post date: [December 26, 2023, 7:25am UTC](https://discourse.julialang.org/t/heres-a-fun-thing/106556/17 "2023-12-26T07:25:16Z")

</div>

The whole discussion is interesting, but this point in particular.

> [@mkitti](#):
>
> There are several issues with `T::DataType`. One is that a type such as `Dict` without its parameters is not a `DataType`! It’s actually a `UnionAll`. `Dict` is equivalent to `Dict{K,V} where {K,V}`, which is a union of several types. If we want to match both `Dict`, `Dict{Symbol}`, and `Dict{Symbol, Any}` we would need to use their common ancestor, `Type`. In this specific case, we only practically wanted to match `Symbol`, so `DataType` would have worked. Another important consequence of matching `Type{T}` is that the Julia function can specialize for `T`. That would not be the case for `DataType` since we cannot specialize on a value. Therefore, we tend to use the idiom `::Type{T}` as this works for the general case of types and allows for specialization.

On others (the one using Iterators.map or using LISP) I need more time to “study” them.

I had experimented with the use of the multiple dispatching and recursion technique to traverse nested structures on [another occasion](https://discourse.julialang.org/t/search-nested-namedtuples-by-key/84352/2) (where I also learned another important lesson on the use of TYPES [in many cases it is preferable to use DICT instead of NamedTuple to avoid overload of compilation]).  
In that case I wasn’t able to take advantage of the abstraction made available by the Accessors package.  
I ask @aplavin if AccessorsExtra could be useful for the case covered in [that discussion](https://discourse.julialang.org/t/search-nested-namedtuples-by-key/84352/2):

> [@aplavin](#):
>
> This is yet another problem where I’d like to suggest a simple optics-based solution (:

---

_[View the full topic](https://discourse.julialang.org/t/heres-a-fun-thing/106556)._
