Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Add the ability to hide certain underscored attributes #232

Open
karwa opened this issue Mar 28, 2021 · 0 comments
Open

Add the ability to hide certain underscored attributes #232

karwa opened this issue Mar 28, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@karwa
Copy link

karwa commented Mar 28, 2021

A project I'm working on makes use of @_specialize as an alternative to inlining in certain circumstances. It can be a really great tool for getting the best performance with the smallest code size. Unfortunately, it leads to quite a bit of noise in the documentation.

It would be great if there was a way to hide these. @_specialize is irrelevant to anybody who uses an API - essentially what it does is, well, generates specialisations of a generic function, and within the function call, figures out if there's an optimised copy to dispatch to. Basically it's like making the compiler write:

func myFunc<S: StringProtocol>(_ value: S) -> Int {
  if let stringValue = value as? String {
    return myFunc_specialised_for_string(stringValue)
  } else if let substringValue = value as? Substring {
    return myFunc_specialised_for_substring(substringValue)
  } else {
    return myFunc_unspecialised(value)
  }
}

image

mattt added a commit that referenced this issue Apr 24, 2021
@mattt mattt added the enhancement New feature or request label Jun 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants