4 ms·
"A pure function is one without any side-effects." https://ocaml.org/docs/functional-programming https://ocaml.org/docs/functional-programming "V functions ar
by mawfig 4y ago
"A pure function is one without any side-effects."
https://ocaml.org/docs/functional-programming https://ocaml.org/docs/functional-programming
"V functions are pure by default, meaning that their return values are a function of their arguments only, and their evaluation has no side effects (besides I/O)."
https://github.com/vlang/v/blob/master/doc/docs.md#pure-functions-by-default https://github.com/vlang/v/blob/master/doc/docs.md#pure-func...
It sure sounds to me like V is trying to claim that functions can be pure while still performing I/O.
- Tozen 4y agoV's documentation is making it clear that it's not a purely functional language, so there should not be any such expectations. It also gives it's interpretation of what a pure function is, which other languages do as well, and there are various opinions about this. You appear to be unbothered by OCaml describing itself as "mostly pure", whatever such "marketing" truly means, but seem to take strong offense to V. Seems like "mostly pure", in either case, should be equally acceptable or generate equal outrage.
- xigoi 4y agoV's documentation says that V's functions are pure by default, but they aren't.
- ptx 4y agoThis thread appears to be conflating two different things: whether a language is a "purely functional language" and whether the language's functions are "pure functions". Presumably a purely functional language would, it seems to me, be exclusively (i.e. purely) functional, i.e. the functions in the language would always be pure. A language that has pure functions and impure functions, on the other hand, would not be "purely functional" as it contains impure parts, but it could still contain pure parts as well. The issue with V seems to be that, although everyone agrees that it contains impure parts and thus is not a "purely functional language", the supposedly "pure functions" are also not actually pure, according to some reasonable definitions of purity.
- creata 4y agoYeah, "no side effects (besides I/O)" is so absurd it's funny.
- slimygrapes 4y agoWhich means you are conceiving a strawman to mock. The point is “no side effects other than IO” is a useful observation to make about how a language feels to use and the kinds of programs it encourages one to write. Whether V is a good example of such a language I’ve no idea.
- amedvednikov 4y agoExactly, that was the idea. The wording was already changed a couple of weeks ago to more clear on the home page. Will update the docs as well.