# Can we have \`String\`s/\`Cmd\`s as type parameter?

**URL:** <https://discourse.julialang.org/t/can-we-have-string-s-cmd-s-as-type-parameter/31647>\
**Category:** General Usage\
**Tags:** parametric-types\
**Created:** [November 29, 2019, 9:26am UTC](https://discourse.julialang.org/t/can-we-have-string-s-cmd-s-as-type-parameter/31647 "2019-11-29T09:26:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Post date:** [November 29, 2019, 9:26am UTC](https://discourse.julialang.org/t/can-we-have-string-s-cmd-s-as-type-parameter/31647/1 "2019-11-29T09:26:43Z")

</div>

I am working on Julia 1.3 and find we can have `Number`s, `Symbol`s and `Char`s, etc., as type parameters, but they cannot be `String`s, `Cmd`s, etc.

```julia
julia> struct A{T}
       end

julia> A{333}()
A{333}()

julia> A{"fd"}()
ERROR: TypeError: in Type, in parameter, expected Type, got String
Stacktrace:
 [1] top-level scope at REPL[5]:1

julia> A{:fd}()
A{:fd}()

julia> A{1.0}()
A{1.0}()

julia> x = complex(1,2)
1 + 2im

julia> A{x}()
A{1 + 2im}()

julia> A{`run`}()
ERROR: TypeError: in Type, in parameter, expected Type, got Cmd
Stacktrace:
 [1] top-level scope at REPL[16]:1

```

What is the reason behind that? What other type of values can we use for type parameters?

---

<div class="post-metadata">

**Author:** ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Post date:** [June 12, 2020, 12:04pm UTC](https://discourse.julialang.org/t/can-we-have-string-s-cmd-s-as-type-parameter/31647/2 "2020-06-12T12:04:13Z")

</div>

I found in [this post](https://discourse.julialang.org/t/how-to-use-a-type-wrapping-a-symbol-as-a-type-parameter/19628) and the docs of [`isbitstype`](http://docs.julialang.org/en/v1/base/base/#Base.isbitstype) and [`Val`](http://docs.julialang.org/en/v1/base/base/#Base.Val) that only values that are `isbits` can be used, plus `Symbols`. See the first post for more details.

---

<div class="post-metadata">

**Author:** ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Post date:** [June 12, 2020, 12:06pm UTC](https://discourse.julialang.org/t/can-we-have-string-s-cmd-s-as-type-parameter/31647/3 "2020-06-12T12:06:33Z")

</div>

Duplicate of [Arguments for Value types](https://discourse.julialang.org/t/arguments-for-value-types/19845)
