# \#syntax

**URL:** https://discuss.ocaml.org/tag/syntax/139.md

[Latest](https://discuss.ocaml.org/latest.md) · [Categories](https://discuss.ocaml.org/categories.md) · [Tags](https://discuss.ocaml.org/tags.md)

---

## [Struct, sig, do ... -\> begin?](https://discuss.ocaml.org/t/struct-sig-do-begin/18493)

<div class="topic-metadata">

**Author:** [@yawaramin](https://discuss.ocaml.org/u/yawaramin)\
**Replies:** 3\
**Last updated:** [September 1, 2026, 3:51am UTC](https://discuss.ocaml.org/t/struct-sig-do-begin/18493 "2026-09-01T03:51:32Z")

</div>

We have various syntactic structures that contain blocks of code, eg: for ... do end module M = struct end module type MT = sig end We also have begin...end which seems to be a synonym for (...). Is there some reaso…

---

## [Has there been a syntax proposed for combining .mli into .ml?](https://discuss.ocaml.org/t/has-there-been-a-syntax-proposed-for-combining-mli-into-ml/15163)

<div class="topic-metadata">

**Author:** [@jbeckford](https://discuss.ocaml.org/u/jbeckford)\
**Replies:** 27\
**Last updated:** [September 3, 2024, 9:08pm UTC](https://discuss.ocaml.org/t/has-there-been-a-syntax-proposed-for-combining-mli-into-ml/15163 "2024-09-03T21:08:38Z")

</div>

I don’t know why but it really bugs me when I have to create a .mli file to introduce a signature to a .ml module. Perhaps it is disrupts my flow while I’m coding. Or simply having to flip back and forth between two fil…

---

## [Left and right associative operators](https://discuss.ocaml.org/t/left-and-right-associative-operators/15156)

<div class="topic-metadata">

**Author:** [@pyvovale](https://discuss.ocaml.org/u/pyvovale)\
**Replies:** 2\
**Last updated:** [August 18, 2024, 4:42pm UTC](https://discuss.ocaml.org/t/left-and-right-associative-operators/15156 "2024-08-18T16:42:39Z")

</div>

In the book Real World OCaml, this section explains a few things about operators. However, the following code is extremely confusing: let (|\>) x f = f x and let (^\>) x f = f x I do not see any difference between the…

---

## ["let in" chaining vs "let and in" expressions](https://discuss.ocaml.org/t/let-in-chaining-vs-let-and-in-expressions/14467)

<div class="topic-metadata">

**Author:** [@avolus](https://discuss.ocaml.org/u/avolus)\
**Replies:** 2\
**Last updated:** [April 12, 2024, 5:47pm UTC](https://discuss.ocaml.org/t/let-in-chaining-vs-let-and-in-expressions/14467 "2024-04-12T17:47:56Z")

</div>

Hi folks! I’m new to OCaml and enjoying the learning experience a lot. I’m using the Cornell book, which I can wholeheartedly recommend to any newbies - it’s great. While I was trying to solve a capture-the-flag a frie…

---

## [Empty records and record types?](https://discuss.ocaml.org/t/empty-records-and-record-types/14387)

<div class="topic-metadata">

**Author:** [@dibri](https://discuss.ocaml.org/u/dibri)\
**Replies:** 4\
**Last updated:** [March 29, 2024, 10:15pm UTC](https://discuss.ocaml.org/t/empty-records-and-record-types/14387 "2024-03-29T22:15:56Z")

</div>

I am new to the language and attempting to model tables in OCaml. My current implementation (an object with 1 attr, a list of records) seems to meet my criteria but is not sufficient for reasoning about empty tables, as …

---

## [Passing (the output of) one function straight into another](https://discuss.ocaml.org/t/passing-the-output-of-one-function-straight-into-another/13511)

<div class="topic-metadata">

**Author:** [@hmackiernan](https://discuss.ocaml.org/u/hmackiernan)\
**Replies:** 3\
**Last updated:** [November 27, 2023, 5:15pm UTC](https://discuss.ocaml.org/t/passing-the-output-of-one-function-straight-into-another/13511 "2023-11-27T17:15:28Z")

</div>

I am currently just starting out with OCaml and am working through this tutorial: Inside the utop REPL, We’ve defined a recursive function range that takes two int lo and hi and returns a list from lo to hi let rec …

---

## [\[Q\] How to distinguish function definition scopes? Because compiler is complaining](https://discuss.ocaml.org/t/q-how-to-distinguish-function-definition-scopes-because-compiler-is-complaining/11729)

<div class="topic-metadata">

**Author:** [@anzhi0708](https://discuss.ocaml.org/u/anzhi0708)\
**Replies:** 4\
**Last updated:** [March 20, 2023, 4:33pm UTC](https://discuss.ocaml.org/t/q-how-to-distinguish-function-definition-scopes-because-compiler-is-complaining/11729 "2023-03-20T16:33:01Z")

</div>

Hello there! It’s me again, the OCaml noob. type choice = | Add\_semicolon | Add\_keyword\_in | Add\_nothing Now I know that you can use let f x = ... to define a function but I still get confused whether to add the keywor…

---

## [【Q】Tutorial for extended syntax?](https://discuss.ocaml.org/t/q-tutorial-for-extended-syntax/11724)

<div class="topic-metadata">

**Author:** [@anzhi0708](https://discuss.ocaml.org/u/anzhi0708)\
**Replies:** 3\
**Last updated:** [March 20, 2023, 12:41pm UTC](https://discuss.ocaml.org/t/q-tutorial-for-extended-syntax/11724 "2023-03-20T12:41:57Z")

</div>

Hello there! As an OCaml / FP noob, I recently discovered an OCaml web framework - you probably familiar with - Dream, and when I look into the example code, I found that they use a quite different syntax from native OC…

---

## [【Q】Why is it 0?](https://discuss.ocaml.org/t/q-why-is-it-0/11688)

<div class="topic-metadata">

**Author:** [@anzhi0708](https://discuss.ocaml.org/u/anzhi0708)\
**Replies:** 2\
**Last updated:** [March 17, 2023, 9:58am UTC](https://discuss.ocaml.org/t/q-why-is-it-0/11688 "2023-03-17T09:58:35Z")

</div>

Hello! I’m both an OCaml beginner and a CS beginner AKA a noob. I was expecting variable money’s value to equal to 0 since race condition but its value was still 0. Can someone explain? Thanks a lot :3 let money = ref…

---

## [Hygienic macros for OCaml](https://discuss.ocaml.org/t/hygienic-macros-for-ocaml/10522)

<div class="topic-metadata">

**Author:** [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Replies:** 6\
**Last updated:** [October 10, 2022, 7:40am UTC](https://discuss.ocaml.org/t/hygienic-macros-for-ocaml/10522 "2022-10-10T07:40:32Z")

</div>

I’ve been thinking about how to cleanly implement some form of hygienic macros for OCaml. Specifically, I’m thinking about how to implement something like Rust’s macro\_rules. The problem there, is that the objects the …

---

## [Is the fun keyword strictly necessary in the language grammar?](https://discuss.ocaml.org/t/is-the-fun-keyword-strictly-necessary-in-the-language-grammar/6874)

<div class="topic-metadata">

**Author:** [@cdaringe](https://discuss.ocaml.org/u/cdaringe)\
**Replies:** 16\
**Last updated:** [December 2, 2020, 9:23am UTC](https://discuss.ocaml.org/t/is-the-fun-keyword-strictly-necessary-in-the-language-grammar/6874 "2020-12-02T09:23:14Z")

</div>

I write anonymous functions in nearly every program I write. I am curious if the fun keyword is a historic artifact or actually an essential token for disambiguation in the grammar. That is, I know it’s required now for …

---

## [What is this syntax \`type t = (string,int,String.comparator\_witness) Map.t\`?](https://discuss.ocaml.org/t/what-is-this-syntax-type-t-string-int-string-comparator-witness-map-t/5578)

<div class="topic-metadata">

**Author:** [@0xkr](https://discuss.ocaml.org/u/0xkr)\
**Replies:** 2\
**Last updated:** [April 21, 2020, 9:31am UTC](https://discuss.ocaml.org/t/what-is-this-syntax-type-t-string-int-string-comparator-witness-map-t/5578 "2020-04-21T09:31:14Z")

</div>

I am reading Real World Ocaml. I read about the modules and functors. This part type t = (string,int,String.comparator\_witness) Map.t of it is not making sense. What is it doing? What is this syntax? Any pointers in th…

---

## [Warning when using \`a.\[b\] \<- c\` operator with bytes](https://discuss.ocaml.org/t/warning-when-using-a-b-c-operator-with-bytes/1484)

<div class="topic-metadata">

**Author:** [@bcc32](https://discuss.ocaml.org/u/bcc32)\
**Replies:** 8\
**Last updated:** [March 26, 2018, 12:19am UTC](https://discuss.ocaml.org/t/warning-when-using-a-b-c-operator-with-bytes/1484 "2018-03-26T00:19:56Z")

</div>

Prior to -safe-string, the a.\[b\] \<- c operator was used to modify characters in a string: let s = String.make 3 '\\000' in s.\[0\] \<- 'f'; s.\[1\] \<- 'o'; s.\[2\] \<- 'o'; With safe-string, only bytes may be modified, not stri…

---

## [Ppx Aesthetics Discussion](https://discuss.ocaml.org/t/ppx-aesthetics-discussion/1248)

<div class="topic-metadata">

**Author:** [@bluddy](https://discuss.ocaml.org/u/bluddy)\
**Replies:** 11\
**Last updated:** [December 8, 2017, 8:26pm UTC](https://discuss.ocaml.org/t/ppx-aesthetics-discussion/1248 "2017-12-08T20:26:06Z")

</div>

Disclaimer: this post is purely about minor matters of syntax aesthetics. If you don’t want to spend any time on this, please move on to another topic. Having said that, I’ve always been bothered by how ugly ppx extensi…

---

## [Reason - general function syntax discussion](https://discuss.ocaml.org/t/reason-general-function-syntax-discussion/537)

<div class="topic-metadata">

**Author:** [@bsansouci](https://discuss.ocaml.org/u/bsansouci)\
**Replies:** 60\
**Last updated:** [October 29, 2017, 3:55am UTC](https://discuss.ocaml.org/t/reason-general-function-syntax-discussion/537 "2017-10-29T03:55:54Z")

</div>

Hey everyone, (continued discussion from #1299) Context: Reason would like to appeal to a broader audience (which, so far, has been JS programmers). The simple approach that’s been taken is to mimic JS syntax in some g…
