2 ms·
Wow this is really interesting, I did not know that, and it explains their choices. And C's function pointer types are indeed written in a bizarre way. I defin
by protomikron 10y ago
Wow this is really interesting, I did not know that, and it explains their choices. And C's function pointer types are indeed written in a bizarre way.
I definitely think of (int * i) as (i :: Ptr Integer) and (* i) in an expression like 42 + * i as (* :: Ptr Integer -> Integer).
- evincarofautumn 10y agoYeah, as long as we’re mixing notations, it’s really: *i :: Integer From which you can conclude i :: Ptr Integer. And the dereference operator does have the type you specified, but not in an lvalue—there the operator is really a mixfix one: (*_ = _) :: Ptr a -> a -> a This isn’t specified directly by the standard, but follows from the rules about how an assignment operator must examine the structure of its first operand.