3 ms·
|x| for captures is from Ruby. Special ops are formed by adding another symbol onto an operator: wrapping ops are +% -% etc, saturating ops are +| -| etc. This
by edflsafoiewq 4y ago
|x| for captures is from Ruby.
Special ops are formed by adding another symbol onto an operator: wrapping ops are +% -% etc, saturating ops are +| -| etc. This pattern was perhaps inspired by OCaml, which uses +. -. etc for floating point ops. The | for saturating is because "| looks like a wall".
The <op>= syntax is of course from C.
p.* is pointer deference. It was probably chosen for parsing reasons. The * is C for dereference, the . prevents ambiguity with multiplication. It may have been inspired by the postfix p^ from Pascal.
The .fire is just MyEnumType.fire with MyEnumType omitted; the type will be inferred.