[swift-evolution] [Pitch] Improve `init(repeating:count)`

Daryle Walker darylew at mac.com
Sat Aug 19 13:46:12 CDT 2017


> On Aug 17, 2017, at 1:06 PM, Erica Sadun via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Also, for those of you here who haven't heard my previous rant on the subject, I dislike using map for generating values that don't depend on transforming a domain to a range. (It has been argued that `_ in` is mapping from `Void`, but I still dislike it immensely)
> 
> Here are the ways that I have approached this:
> 
> // Ugh
> [UIView(), UIView(), UIView(), UIView(), UIView()]

What if we got a duplication “macro”:

[ #dup(5 ; UIView()) ]

It’s not a true macro because it reads the count when “constexpr” objects would be evaluated.

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 



More information about the swift-evolution mailing list