# Usage of Ast.full.FnProto.iterate?

**URL:** <https://ziggit.dev/t/usage-of-ast-full-fnproto-iterate/17564>\
**Category:** Help\
**Tags:** compiler, standard-library\
**Created:** [September 11, 2026, 11:58am UTC](https://ziggit.dev/t/usage-of-ast-full-fnproto-iterate/17564 "2026-09-11T11:58:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hvbargen](https://ziggit.dev/user_avatar/ziggit.dev/hvbargen/32/5696_2.png) [@hvbargen](https://ziggit.dev/u/hvbargen)\
**Post date:** [September 11, 2026, 11:58am UTC](https://ziggit.dev/t/usage-of-ast-full-fnproto-iterate/17564/1 "2026-09-11T11:58:39Z")

</div>

I try using Ast for parsing a Zig source code to generate a different Zig source (for context: I’m trying to generate a wrapper for Raylib for my toy language Moin).

I started with adapting Ast.Render, but the code for looping through the args of a function is a bit complicated, so I looked for a cleaner way. The `iterate` function returns an `Iterator`for the arguments. This works in some cases, but in other cases it panics, because the `ast.params` slice just contains a single zero.

Is this a bug?

Anyone else here used the Ast for metaprogramming and stumbled over this?

---

<div class="post-metadata">

**Author:** ![hvbargen](https://ziggit.dev/user_avatar/ziggit.dev/hvbargen/32/5696_2.png) [@hvbargen](https://ziggit.dev/u/hvbargen)\
**Post date:** [September 19, 2026, 9:11am UTC](https://ziggit.dev/t/usage-of-ast-full-fnproto-iterate/17564/2 "2026-09-19T09:11:37Z")

</div>

Not sure if that’s the reason, because I changed a lot, but today I saw that I stored the `FnProto` data for later use. This is not valid, however, because the `ast.params` attribute is a slice with a short lifetime. I’m not using `iterate` anymore, but I had other issues which vanished after `dupe`ing the prams slice for later use.
