# Identifiers in \`\_fun\`

**URL:** <https://racket.discourse.group/t/identifiers-in-fun/1769>\
**Category:** Questions & Answers\
**Tags:** question, ffi\
**Created:** [March 9, 2023, 3:38pm UTC](https://racket.discourse.group/t/identifiers-in-fun/1769 "2023-03-09T15:38:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antigen-11](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/antigen-11/32/1813_2.png) [@Antigen-11](https://racket.discourse.group/u/Antigen-11)\
**Post date:** [March 9, 2023, 3:38pm UTC](https://racket.discourse.group/t/identifiers-in-fun/1769/1 "2023-03-09T15:38:08Z")

</div>

I typed this in the repl and an error was raised:

```scheme
> (require ffi/unsafe)
> (_fun (f) :: ((_array/list _int (length f)) = f) -> _int)
f: undefined;
 cannot reference an identifier before its definition
  in module: top-level
 [,bt for context]

```

It seems that the identifier `f` in the type expression is not bound and I have to do something else to fix the scope.

How to use the `_array/list` elegantly?

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [March 9, 2023, 5:47pm UTC](https://racket.discourse.group/t/identifiers-in-fun/1769/2 "2023-03-09T17:47:33Z")

</div>

I'm not sure what the intended semantics of the function type you're describing are, but you have the syntax of `_fun` incorrect. The type of `f` needs to needs to be specified like this: `(f : <type here>)` and there's no use of `::`.

---

<div class="post-metadata">

**Author:** ![ryanc](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/ryanc/32/71_2.png) [@ryanc](https://racket.discourse.group/u/ryanc)\
**Post date:** [March 9, 2023, 6:56pm UTC](https://racket.discourse.group/t/identifiers-in-fun/1769/3 "2023-03-09T18:56:58Z")

</div>

The argument names (eg, `f`) are not in scope in the type expressions. It would be strange for the _calling convention_ of a function to change depending on the actual values passed to it. The `_fun` syntax is syntactic sugar for `_cprocedure`, which just takes a list of input types.

I believe `_array/list` is mainly for use within `define-cstruct`. For function calls, C passes an array argument as a pointer, so you probably just want to use `_list` instead, as in `(_list i _int)`.
