9 ms·
Agree, can someone explain me what does `ignore @@ context##drawImage sprite.img sx sy sw sh dx dy dw dh` mean? I coulnd't find `ignore` in Reason docs from ht
by edanchenkov 9y ago
Agree, can someone explain me what does `ignore @@ context##drawImage sprite.img sx sy sw sh dx dy dw dh` mean? I coulnd't find `ignore` in Reason docs
from
https://github.com/reasonml-community/Mareo/blob/master/src/draw.re#L23 https://github.com/reasonml-community/Mareo/blob/master/src/...
- manu3000 9y agoit calls the method drawImage on the context object. ignore, in OCaml, allows to "cast the expression to void"
- LeonidasXIV 9y agoCasting is a bit of a wrong term here, since that's not at all what happens. `ignore` is just a function that takes any argument and returns `()` (unit). That's useful because sometimes you want to throw away the result of the computation (usually a side effect), so you can just call `ignore` on it and get a `()` value out.
- masklinn 9y ago"ignore" is a standard ocaml function: https://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALignore https://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasive... val ignore : 'a -> unit it just discards the value it is given. "@@" is a low-binding application operator, similar to Haskell's "$", it's used to avoid parenthesising.