Skip to content

Automatically infer type based on default #131

@mauro3

Description

@mauro3

Something like this could be useful:

@with_kw struct A
  a::typeof = 1:0.4:7
end

instead of a::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}} or a::typeof(1:0.4:7).

Could be added to @deftype as well

@with_kw struct A @deftype_typeof
  a = 1:0.4:7
  b = 7.0
  c = "a"
end

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions