Hacker News new | ask | show | jobs
by AboutTheWhisles 3050 days ago
Wouldn't that just be a struct?
1 comments

Like an ad-hoc anonymously typed struct. Only the members are named, so each time the type is specified it is with the member names, hence just using a type name is preferred. If it is really just used at one or two call sites and not propagated all is well, but invariably things tend to expand in use.
I still don't quite see why you wouldn't just use a named struct, but you can create a alias for the NamedTuple type

    const MyAlias = NamedTuple{(:a, :b),Tuple{Int64,Int64}}
    MyAlias((2, 3)) # (a = 2, b = 3)