# \`@convention(thin)\` function pointers

**URL:** <https://forums.swift.org/t/convention-thin-function-pointers/65180>\
**Category:** Pitches\
**Created:** [May 24, 2023, 11:13pm UTC](https://forums.swift.org/t/convention-thin-function-pointers/65180 "2023-05-24T23:13:26Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jrose](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jrose/32/408_2.png) [@jrose](https://forums.swift.org/u/jrose)\
**Post date:** [May 25, 2023, 1:20am UTC](https://forums.swift.org/t/convention-thin-function-pointers/65180/4 "2023-05-25T01:20:16Z")

</div>

So this is sneakily a proposal for `direct`/`indirect`. :-) I do have some questions/concerns:

- Does directness + ownership fully capture the calling convention for _all_ types, and are we sure that will be true in the future?

- Will the compiler have to diagnose types that can't be passed directly? Up until now I think that hasn't been a Sema-level (roughly, "type-checking time") concept, and maybe it's still something that can be deferred to SIL diagnostics (roughly, "flow-sensitive diagnostics that run later in compilation than type-checking"). But I do worry about people trying to use `direct NonFrozenStruct` outside the original module and getting weird errors from the compiler, and I myself don't know whether `direct Any` or `indirect NSObject` are valid concepts or not.

- Having `@symbolName` without `@cdecl` worries me: I think people will start exposing Swift functions to C [even more than they already do], and have things mostly work but then cause extremely weird errors in the corner cases. (But while [`@cdecl` isn't _that_ much more work](https://forums.swift.org/t/formalizing-cdecl/40677), it's a lot more than this…)

- The dlsym code is only correct if both sides use the same ABI, which could be a cause of weird issues on non-stable-ABI platforms if people don't think about it. But there _is_ an unsafeBitCast there, so maybe it's ""fine"".

---

_[View the full topic](https://forums.swift.org/t/convention-thin-function-pointers/65180)._
