# New blog post about Julia parametric types and constructors

**URL:** <https://discourse.julialang.org/t/new-blog-post-about-julia-parametric-types-and-constructors/120717>\
**Category:** Teaching & Outreach\
**Tags:** parametric-types, constructors\
**Created:** [September 30, 2024, 11:03am UTC](https://discourse.julialang.org/t/new-blog-post-about-julia-parametric-types-and-constructors/120717 "2024-09-30T11:03:52Z")\
**Posts on this page:** 1\
**Showing post:** 11

<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:** [October 7, 2024, 5:24pm UTC](https://discourse.julialang.org/t/new-blog-post-about-julia-parametric-types-and-constructors/120717/11 "2024-10-07T17:24:50Z")

</div>

This sentence from the blog post should be corrected, it’s incorrect, or at least highly misleading:

> Parametric types can be **highly** efficient when the type `T` is _concrete_ (i.e., not abstract).

The issue is that “abstract” is ambiguous, in Julia it _sometimes_ refers to any non-concrete type, but it’s AFAIK more proper to use it to refer merely to types declared with `abstract type`. The _latter_ meaning is the one used by `isabstracttype`. Thus `isconcretetype` and `isabstracttype` are _not_ opposites.

EDIT (more than three consecutive replies are not allowed):

A visualization of Julia’s subtyping might also be educational. Given these example Julia types:

```julia
abstract type PointSupertype0 end
abstract type PointSupertype1{T} <: PointSupertype0 end

struct Point{T} <: PointSupertype1{T} end

types = (
    Point, PointSupertype0, PointSupertype1,
    PointSupertype1{Int}, PointSupertype1{<:Int},
    PointSupertype1{Float64}, PointSupertype1{<:Float64},
    Point{Int}, Point{<:Int}, Point{Float64}, Point{<:Float64},
    Point{Union{Int, Float64}}, Point{<:Union{Int, Float64}},
    Union{Point{Int}, Point{Float64}},
    Union{Point{<:Int}, Point{<:Float64}},
)

```

… a Julia script makes a digraph from the subtyping relation, does transitive reduction on it, then produces this GraphViz Dot specification for visualizing:

```sh
digraph='
digraph {
    "Point" -> "PointSupertype1"
    "PointSupertype1" -> "PointSupertype0"
    "PointSupertype1{<:Float64}" -> "PointSupertype1"
    "PointSupertype1{<:Int64}" -> "PointSupertype1"
    "PointSupertype1{Float64}" -> "PointSupertype1{<:Float64}"
    "PointSupertype1{Int64}" -> "PointSupertype1{<:Int64}"
    "Point{<:Float64}" -> "PointSupertype1{<:Float64}"
    "Point{<:Float64}" -> "Union{Point{<:Int64}, Point{<:Float64}}"
    "Point{<:Int64}" -> "PointSupertype1{<:Int64}"
    "Point{<:Int64}" -> "Union{Point{<:Int64}, Point{<:Float64}}"
    "Point{<:Union{Float64, Int64}}" -> "Point"
    "Point{Float64}" -> "PointSupertype1{Float64}"
    "Point{Float64}" -> "Point{<:Float64}"
    "Point{Float64}" -> "Union{Point{Float64}, Point{Int64}}"
    "Point{Int64}" -> "PointSupertype1{Int64}"
    "Point{Int64}" -> "Point{<:Int64}"
    "Point{Int64}" -> "Union{Point{Float64}, Point{Int64}}"
    "Point{Union{Float64, Int64}}" -> "Point{<:Union{Float64, Int64}}"
    "Union{Point{<:Int64}, Point{<:Float64}}" -> "Point{<:Union{Float64, Int64}}"
    "Union{Point{Float64}, Point{Int64}}" -> "Union{Point{<:Int64}, Point{<:Float64}}"
}
'
printf '%s' "$digraph" | dot -Tpng > /tmp/graphviz.png

```

This is the result:

 ![graphviz](https://global.discourse-cdn.com/julialang/original/3X/4/b/4bec158259701cda0823b465e4a127d7b30bae98.png)

---

_[View the full topic](https://discourse.julialang.org/t/new-blog-post-about-julia-parametric-types-and-constructors/120717)._
