Skip to content

Readability improvements to the tour page - #3654

Open
anirudh24seven wants to merge 4 commits into
ocaml:mainfrom
anirudh24seven:patch-1
Open

Readability improvements to the tour page#3654
anirudh24seven wants to merge 4 commits into
ocaml:mainfrom
anirudh24seven:patch-1

Conversation

@anirudh24seven

Copy link
Copy Markdown

I strongly believe that first party guides, docs and error messages help adoption by new users of the language. I am proposing some changes to the Tour of OCaml page so that it becomes easier to read by such beginners.

Please let me know if I can make them any better. I am willing to iterate on this.

@cuihtlauac cuihtlauac left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @anirudh24seven. Giving a name to the material that describes bindings is a good idea. The rest can be fixed.

More importantly, Bindings should be under Expressions And Definitions not at the same level. For consistency, it's probably better to use Definitions at both levels (in ## and ###) and explain that definition is a not-nameless binding in a sentence. Also, Expressions and Definitions can't have a single subsection, if a Definitions/Bindings section exists, an Expressions one is needed.

```

In OCaml, everything has a value, and every value has a type. The above example says, “`50 * 50` is an expression that has type `int` (integer) and evaluates to `2500`.” Since it is an anonymous expression, the character `-` appears instead of a name.
In OCaml, everything has a value, and every value has a type. The above example says, the input “`50 * 50` is an expression that has type `int` (integer) and evaluates to `2500`.” Since it is an anonymous expression, the character `-` appears instead of a name, in the output (Note that this is different from `_` in the input that we will address later).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parenthetical text does not help here. It is a forward reference, we try to avoid that.

Suggested change
In OCaml, everything has a value, and every value has a type. The above example says, the input “`50 * 50` is an expression that has type `int` (integer) and evaluates to `2500`.” Since it is an anonymous expression, the character `-` appears instead of a name, in the output (Note that this is different from `_` in the input that we will address later).
In OCaml, everything has a value, and every value has a type. The above example says, the input “`50 * 50` is an expression that has type `int` (integer) and evaluates to `2500`.” Since it is an anonymous expression, the character `-` appears instead of a name, in the output.

```

The lists' types, `int list` and `string list`, have been inferred from the type of their elements. Lists can be empty `[]` (pronounced “nil”). Note that the first list has been given a name using the `let … = …` construction, which is detailed below. The most primitive operation on lists is to add a new element at the front of an existing list. This is done using the “cons” operator, written with the double colon operator `::`.
(`let` and `val` are explained next in the [Bindings](#bindings) section)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fully parenthetical and single sentence paragraph isn't correct formatting.

The lists' types, `int list` and `string list`, have been inferred from the type of their elements. Lists can be empty `[]` (pronounced “nil”). Note that the first list has been given a name using the `let … = …` construction, which is detailed below. The most primitive operation on lists is to add a new element at the front of an existing list. This is done using the “cons” operator, written with the double colon operator `::`.
(`let` and `val` are explained next in the [Bindings](#bindings) section)

The lists' types, `int list` and `string list`, have been inferred from the type of their elements. Lists can be empty `[]`. Note that the first list has been given a name (u) using the `let … = …` construction.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove pronounced “nil” Absolute newbies need that information. Also, there's a remark on name definition here, a reference to the binding section could be introduced here.

Comment on lines +116 to +117

Also note parentheses are not needed here, around the `if`, which is often the case in OCaml.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to avoid single sentence paragraphs.

Comment on lines -118 to +137
There is no overloading in OCaml, so inside a lexical scope, names have a single value, which only depends on its definition.
Inside a lexical scope, names have a single value (the one it was bound to with `let`). There is no ambiguity as there is no overloading in OCaml.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default, we prefer stating cause first and consequence second.

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

Successfully merging this pull request may close these issues.

2 participants