Post

Replies

Boosts

Views

Activity

Reply to Can a function with parameter packs return a non-generic value for each parameter?
It should be possible, but at present the compiler only allows implicit repeatable non-generic types, like (repeat String). Consider the following: func mirrorString<each M>(_ input: repeat each M) -> String { let result = (repeat String(describing: each input)) return String(describing: result) } The variable result has an implicit type. Option click the variable and see, let result: (repeat String). However it is not possible to explicitly declare (repeat String) as a variable type or a return type. I believe this to be a bug.
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’23