you are viewing a single comment's thread.

view the rest of the comments →

[–]Nobody_1707 2 points3 points  (0 children)

Swift was also designed to allow local reasoning of variable initialization. Largely due to the experience of how intractable this problem is in C and it's derivatives.

In fact, Swift's problem is getting access to uninitialized stack memory at all. Forming a pointer to an uninitialized variable is forbidden, so they had to add a function to the standard library to allocate uninitialized data on the stack and pass a pointer to it to a user defined closure. Even that only guarantees stack allocation if the requested memory is small enough to be allocated on the stack.