# How to pass name of macro argument into result struct parameter

**URL:** <https://discourse.julialang.org/t/how-to-pass-name-of-macro-argument-into-result-struct-parameter/101049>\
**Category:** General Usage\
**Tags:** macros\
**Created:** [July 1, 2023, 10:34am UTC](https://discourse.julialang.org/t/how-to-pass-name-of-macro-argument-into-result-struct-parameter/101049 "2023-07-01T10:34:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrey2185](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrey2185/32/9889_2.png) [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Post date:** [July 1, 2023, 10:34am UTC](https://discourse.julialang.org/t/how-to-pass-name-of-macro-argument-into-result-struct-parameter/101049/1 "2023-07-01T10:34:17Z")

</div>

Hello, please help to pass name of macro argument into result struct parameter

```julia
struct Foo{x} end

macro foo(x)
    return esc(:($x = Foo{QuoteNode($x)})) # ???
end

@macroexpand @foo x # need - > # x = Foo{:x} 

x = 2

# but i get error:
@foo x 
ERROR: TypeError: in Type, in parameter, expected Type, got a value of type QuoteNode

```

---

<div class="post-metadata">

**Author:** ![andrey2185](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrey2185/32/9889_2.png) [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Post date:** [July 1, 2023, 10:36am UTC](https://discourse.julialang.org/t/how-to-pass-name-of-macro-argument-into-result-struct-parameter/101049/2 "2023-07-01T10:36:47Z")

</div>

```julia
macro foo(x)
    xs = QuoteNode(x)
    return esc(:($x = Foo{$xs}))
end

```
