Skip to content

What is the best way to do terse type printing? #1

@jonniedie

Description

@jonniedie

Example:

@concrete terse struct MyType{B}
    a
    b::B
end

x = MyType("hi", 2.0)

Here is what the full type looks like (the explicitly declared parameters always come first, regardless of the position of their corresponding fields):

julia> typeof(x)
MyType{Float64,String}

Options:

  1. No type params (baseline):
julia> x
MyType("hi", 2.0)
  1. Elipses:
julia> x
MyType{...}("hi", 2.0)
  1. Only the explicitly declared params:
julia> x
MyType{Float64}("hi", 2.0)
  1. Only the explicitly declared params, but with elipses:
julia> x
MyType{Float64,...}("hi", 2.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    decisionDecide between multiple valid options

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions