Skip to content

PR#6676: move overriding class definitions to language reference chapter#1153

Merged
mshinwell merged 2 commits intoocaml:trunkfrom
Octachron:nme_class_override
May 4, 2017
Merged

PR#6676: move overriding class definitions to language reference chapter#1153
mshinwell merged 2 commits intoocaml:trunkfrom
Octachron:nme_class_override

Conversation

@Octachron
Copy link
Member

This PR moves the description of overriding class definitions —val!, method! and inherit! — from the extension chapter to the language reference chapter, and add two short paragraphs in the object chapter of the tutorial. Since this language extension has a small syntactic footprint and a clearer semantic compared to the open! variant, I think it makes sense to integrate it in the already quite extensive description of the object system.

Since Ocaml 3.12, the keywords @"inherit!"@, @"val!"@ and @"method!"@
have the same semantics as @"inherit"@, @"val"@ and @"method"@, but
they additionally require the definition they introduce to be an
overriding. Namely, @"method!"@ requires @method-name@ to be already
Copy link
Contributor

Choose a reason for hiding this comment

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

Is an "overriding" a name in English? I suggest we should drop the "an". (I know this is the original text.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, the current wording also makes me stop at some point, droping the "an" sounds better.

@mshinwell
Copy link
Contributor

This looks fine to me.

@mshinwell mshinwell merged commit 2dc8621 into ocaml:trunk May 4, 2017
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
Clarifications/rewrites on the "First Hour With OCaml" tutorial.

* add a section about using the OCaml Playground
* mention what # means in the code examples
* spell out what's happening more clearly for beginners

---------

Signed-off-by: Christine Rose <[email protected]>
Co-authored-by: Christine Rose <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants