Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does "pure OCaml" equate "purely functional" in the literature and custom?

My understanding is that "Pure OCaml" means everything that is standard in OCaml, including its non "purely" functional features, whereas "pure functional" means the usual attributes: no side effects, no exception handling, etc. In that sense, "pure OCaml" implementation is said in opposition to, say, OCaml with C, or C++ implementation.

However, I have had a debate on this recently with someone who very much insisted that "pure OCaml", in certain circles, means the "purely functional subset" of OCaml.

Are the two meanings really used in the community? Does there exist such an ambiguity? Are there pointers to some highly regarded sources that use "Pure OCaml" in the second sense?

like image 536
ZakC Avatar asked Nov 30 '22 16:11

ZakC


2 Answers

It is hard to answer such questions because the whole community is asked. They suit better to the OCaml mailing list, although people there maybe a little bit frustrated.

So, I can't answer for the whole community, but I personally think that you're right here. When someone says "pure OCaml" he usually means, that a program is implemented only in OCaml language, without any C stubs.

I never heard about a functionally pure subset of OCaml. And I suspect, that is practically impossible to implement something using only purely functional language features. For example, String module, exceptions, the whole IO subsystem, are strictly nonpure.

like image 137
ivg Avatar answered Dec 05 '22 06:12

ivg


"Pure OCaml" refers to an application or a library written only in the OCaml language.

It excludes the use of the Obj module as it is "not part of the OCaml language" (Xavier Leroy on caml-list http://article.gmane.org/gmane.comp.lang.caml.general/47389).

Depending on the context, it may or may not tolerate C libraries that ship with the standard OCaml distribution but are not part of the standard library (Str, Unix, ...).

like image 38
Martin Jambon Avatar answered Dec 05 '22 05:12

Martin Jambon