# @kwdef and parametric types

**URL:** <https://discourse.julialang.org/t/kwdef-and-parametric-types/39825>\
**Category:** General Usage\
**Tags:** parametric-types\
**Created:** [May 20, 2020, 12:20pm UTC](https://discourse.julialang.org/t/kwdef-and-parametric-types/39825 "2020-05-20T12:20:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [May 20, 2020, 12:20pm UTC](https://discourse.julialang.org/t/kwdef-and-parametric-types/39825/1 "2020-05-20T12:20:24Z")

</div>

I wonder why the following errors:

```julia
julia> Base.@kwdef mutable struct A1{F1}
           a :: F1
           b :: F1 = zero(F1)
       end

julia> A1(a = 1.0)
ERROR: UndefVarError: F1 not defined
Stacktrace:
 [1] (::Core.var"#kw#Type")(::NamedTuple{(:a,),Tuple{Float64}}, ::Type{A1}) at ./none:0
 [2] top-level scope at REPL[32]:1
 [3] eval(::Module, ::Any) at ./boot.jl:330
 [4] eval_user_input(::Any, ::REPL.REPLBackend) at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:86
[...]

```

The same happens when the `struct` is defined using `Parameters.jl`.

Is there a workaround (other than spelling out the type explicitly and redundantly as in `A1{Float64}(a = 1.0)`?
