As a point of fact, most of the things that you list aren't "magic," which isn't a synonym for syntactic sugar, and it's worth pointing out that result builders especially are anything but magic. They are as unmagical as they come.
We use "magic" as a term of art for a feature that's implemented in a way that can't be expressed in the language itself, most often in distinction to something that could just as well be implemented in a third-party library.
It has always been a goal to make things less magical whenever possible. For example, even basic types like Int
are ordinary structs, and even basic operators like +
are ordinary operator functions--all defined in Swift and even shadowable by the end user. (Obviously, at some point, the Swift implementation needs to make use of compiler primitives; we are discussing facets of the language as exposed to the user.)
Each result builder is defined entirely in Swift, and the way in which the result is built up can be understood entirely in terms of the rules of the language. There are no result builders vended by the standard library yet; however, you can refer to the ongoing discussion on string pattern matching for a possible future inclusion. If such a result builder were to be included in the standard library, it would be doing nothing that an end user's own result builder couldn't do. For this reason, result builders are not magical at all.
The ?
operator, by contrast, is as magical as they come. You cannot define a postfix ?
operator to shadow the standard library's. You cannot inspect the declaration of that function, because there is none. If you do not also understand C++, you can't even inspect how Swift implements the behaviors it endows the ?
operator even if you find the implementation.
Along the same lines, you can create a type that conforms to ExpressibleByNilLiteral
(not magical), but there is no amount of cleverness by which you can make a local variable or member of that type implicitly initialized by default to nil
(magical).
This is absolutely not the case, but I see that you're going to simply reassert this without evidence and without engaging with my earlier reasoning as to why, so 