Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functional Programming tutorial claims all basic OCaml types are unboxed. #1611

Open
ninjaaron opened this issue Oct 12, 2021 · 2 comments
Open

Comments

@ninjaaron
Copy link

In C or C++ you should have no problems constructing either of the two types of arrays above. In Java, you have two types, int which is unboxed and Integer which is boxed, and hence considerably less efficient. In OCaml, the basic types are all unboxed.

I'm not sure what is meant by "basic types" here, but this is extremely misleading, since, as far as I know, int is the only common unboxed type in OCaml and even float is normally boxed. It would be good if this was reworded to reflect the fact that almost every non-integer value in OCaml is boxed, and this is indeed a pain-point for OCaml in HPC.

@patricoferris
Copy link
Contributor

patricoferris commented Oct 12, 2021

Hi @ninjaaron thanks for the feedback.

I completely agree, the phrase basic types is ambiguous (at least in this tutorial's context) and most I assume would be thinking of "basic data types" in the manual (see https://ocaml.org/releases/4.12/htmlman/coreexamples.html#s:datatypes), where using that definition this statement is indeed incorrect. Perhaps it would be better with a small explanation and then a link to https://ocaml.org/releases/4.12/htmlman/intfc.html#s:c-ocaml-datatype-repr ?

This is the second time in not so long that this tutorial seems to be incorrect/misleading (see ocaml/ocaml.org#1595) and I agree with @Octachron that overall the tone of the tutorial is not great. I'm wondering if it is causing more harm than good at this point?

@Octachron
Copy link
Member

Octachron commented Oct 12, 2021

Overall, I think that all tutorials would need to be edited. Another piece from the label tutorial:

When and when not to use ~ and ?

The syntax for labels and optional arguments is confusing, and you may often wonder when to use ~foo, when to use ?foo and when to use plain foo. It's something of a black art which takes practice to get right.

I cannot disagree more with the use of black art to try to instill a false sense of familiarity with the reader, at the price of sending a terrible and inaccurate message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants