2

What is the difference between having the pointer type prefixing the type versus having it postfix with a slash prior to it. What does the slash even mean?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Havvy
  • 1,471
  • 14
  • 27

1 Answers1

8

The syntax T/~ and T/& is basically deprecated (I'm not even sure if the compiler still accepts it). In the initial phases of the transition to the new vector scheme, [T]/~ indicated a unique pointer to a vector and [T]/& indicated a slice. These types are now written ~[T] and &[T] respectively. The slash is still used for fixed-length vectors, e.g., [int]/3. This is exactly equivalent to the C type int[3].

Niko Matsakis
  • 2,046
  • 1
  • 13
  • 5