Swift Pointer Syntatic Sugar

If we're reading left to right the obvious answer is UnsafeMutablePointer<Int>?. Compared to Int?* being UnsafeMutablePointer<Int?>.

But wouldn't the ? be more important than the * because it is a system-defined thing? Then we end up will shorthands having precedencegroups.

There's no way for "precedence" to cause the ? to bind before the * in that example; that would have to be its own complex grammar rule, like C's declarator syntax.

If we added user-customizable type sugar using the current operator parsing rules, that would actually be parsed as a single *? operator, which presumably wouldn't be declared and so would be ill-formed.

1 Like

Oh. Sorry

The important thing here is that if such s system were in place then the system ones would be defined through this as well and wouldn’t be compiler special exceptions