mauro3 / Parameters.jl

Types with default field values, keyword constructors and (un-)pack macros
Other
420 stars 31 forks source link

Compatibility with Julia 1.8 const on fields in mutable structs #149

Open joaquinpelle opened 2 years ago

joaquinpelle commented 2 years ago

Julia now supports annotating individual fields of a mutable struct with const annotations. It would be nice if Parameters.jl allowed it, as

@with_kw mutable struct T
    x::Int
    const y::Float64
end
mauro3 commented 2 years ago

Yes that would be an excellent addition.

Note that Base.@kwdef does support this. So, with a re-write of Parameters on top of @kwdef, this would be taken care of.