Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
cuihtlauac authored Jan 27, 2025
1 parent 2aded1d commit 723785a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions data/tutorials/guides/1wf_01_debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ purpose formats are more suited to get the relevant information, than what can
be output automatically by the generic pretty-printer used by the trace
mechanism.

Compiler builtins improve debugging messages. The location of the error in the program can be displayed.
Compiler builtins help display useful debugging messages. They indicate a location in the program's source.
For example,
```ocaml
match Message.unpack response with
| Some y -> y
| None -> (Printf.eprintf "Invalid message at %s" __LOC__; raise Invalid_argument)
```
At compile time, the `__LOC__` builtin is substituted with its location in the program, described as a string `"File %S, line %d, characters %d-%d"`. One can also get the file name, line number, start character and end character directly through the `__POS__` builtin:
At compile time, the `__LOC__` builtin is substituted with its location in the program, described as a string `"File %S, line %d, characters %d-%d"`. File name, line number, start character and end character are also available through the `__POS__` builtin:
```ocaml
match Message.unpack response with
| Some y -> y
Expand Down

0 comments on commit 723785a

Please sign in to comment.