Sometimes less characters does lead to clarity though.
I wouldnât advocate it all the time,
but I think that
const Opt{T} = Union{Missing, T}
struct Metadata
shortname::Opt{String}
fullname::Opt{String}
website::Opt{String}
description::Opt{String}
author::Opt{Vector{String}}
maintainer::Opt{String}
license::Opt{String}
published_date::Opt{Union{Date, DateTime, String}}
create_date::Opt{Union{Date, DateTime, String}}
modified_date::Opt{Union{Date, DateTime, String}}
paper_cite::Opt{String}
dataset_cite::Opt{String}
dataurls::Opt{Vector}
datachecksums::Any
end
is clear than
struct Metadata
shortname::Union{Missing, String}
fullname::Union{Missing, String}
website::Union{Missing, String}
description::Union{Missing, String}
author::Union{Missing, Vector{String}}
maintainer::Union{Missing, String}
license::Union{Missing, String}
published_date::Union{Missing, Date, DateTime,String}
create_date::Union{Missing, Date, DateTime, String}
modified_date::Union{Missing, Date, DateTime, String}
paper_cite::Union{Missing, String}
dataset_cite::Union{Missing, String}
dataurls::Union{Missing, Vector}
datachecksums::Any
end
Because it is just less verbose, so it is easier (for me at least) too see what is going on.
However, such sortage structs are not a particularly common use case.
(Though this type has a number of other issues, that will cause it to be not nesc great for performance; those are irrelevant in this question)