[swift-evolution] [RFC] Definitive Initialization and Incompatibilities with Fixed-size Arrays
Daryle Walker
darylew at mac.com
Tue Jul 18 15:00:41 CDT 2017
> On Jul 17, 2017, at 3:26 AM, Félix Cloutier <felixcca at yahoo.ca> wrote:
>
> I think that you're getting ahead of yourself. Fixed-size arrays are still useful even if they have to have been demonstrably initialized before you can use dynamic indices with them. A ton of people have already gotten into the habit of writing `int foo[40] = {}` in C.
The person with the initial suggestion regrets this habit and deliberately doesn’t want it. In other words, don’t support the waste of cycles to pre-initialize just for the elements to be immediately paved over with the real initial data. And we may make arrays of types that are heavy to initialize and may not have a default initializer, so even using a default-value term at declaration will lead to a big waste of cycles.
We eventually have to decide how to modify deterministic initialization. Do we take the safe path with dynamic deterministic initialization (and add extra resources)? Or the fast path with suspension of checks (and risk undefined behavior)? We’re probably going to lean toward the former, especially since we can limit its scope (and therefore cost).
> I would like to encourage you to exercise your sense of priority and figure out the minimum changes that you need to make to the language to get something useful, without blocking avenues for expansion. I think that everyone, especially the people that you would be signing up for a tremendous amount of work with your current direction, will be happier this way.
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
More information about the swift-evolution
mailing list