Skip to content

Fix typos in contracts.md #1017

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

Merged
merged 70 commits into from
Mar 15, 2024
Merged
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
84f1841
Initial files to test MkDocs with Material
hsutter Feb 11, 2024
3126adb
Update checkout version
hsutter Feb 11, 2024
f6812ac
Trying checkout with no version
hsutter Feb 11, 2024
53a3279
Back to v3
hsutter Feb 11, 2024
a708e37
Try renaming to docs
hsutter Feb 11, 2024
9fcc922
Test push to renamed docs branch
hsutter Feb 11, 2024
4eaa306
Try moving mkdocs.yml to root to unblock CI
hsutter Feb 11, 2024
e3d71c7
Further cleanup to get things in the right directories
hsutter Feb 11, 2024
5bc176e
Finish moving from `/docs/docs` to `/docs`
hsutter Feb 11, 2024
353332c
Add "Cppfront reference," and start writing "Cpp2 reference"
hsutter Feb 12, 2024
3648a58
Merged documentation from blog posts, and unary operators
hsutter Feb 12, 2024
b75d2c0
Integrate links to wiki design notes
hsutter Feb 13, 2024
41d5f3d
Add more sections
hsutter Feb 13, 2024
1f8ac8d
Add `as` and `inspect`
hsutter Feb 13, 2024
2baeb3f
Document declarations, improve `inspect` discussion
hsutter Feb 13, 2024
3b7a9d5
Fix a few typos
hsutter Feb 13, 2024
64deec1
Add Hello-world xref
hsutter Feb 14, 2024
eb085c5
Update mkdocs.yml
hsutter Feb 14, 2024
8f7d265
Improve mixed files examples and flow
hsutter Feb 14, 2024
58e5ec6
Overview editorial improvements
hsutter Feb 14, 2024
335d3a7
Minor cleanup
hsutter Feb 14, 2024
91f193e
docs: fix some typos and confusing wording (#976)
DyXel Feb 14, 2024
d3299fc
Fix table of content display -> rhs of page
hsutter Feb 14, 2024
37b34e3
Add section navigation
hsutter Feb 14, 2024
0786e27
Organize the welcome info into three pages
hsutter Feb 14, 2024
c13d4e6
Disable regression tests on this branch
hsutter Feb 15, 2024
be7cd49
Add more types and `operator=` material
hsutter Feb 15, 2024
bbc25eb
Add keywords, objects, and heap allocation
hsutter Feb 15, 2024
b7c2cd1
Add `main`
hsutter Feb 16, 2024
6796af1
Reviewing cppfront docs (#982)
gregmarr Feb 16, 2024
4ee9a36
Fix "lines 8, 9, and 15" wording
hsutter Feb 16, 2024
1b7017a
Mention UFCS
hsutter Feb 18, 2024
d8d8a5a
Function outputs and explicit discard
hsutter Feb 18, 2024
36475b6
Add definite initialization section
hsutter Feb 19, 2024
9257d97
Update CTAD description in hello-world.md (#984)
bluetarpmedia Feb 19, 2024
6facf81
Embiggen text font, add `move` and `out` arguments
hsutter Feb 19, 2024
8bb227d
Fix small typo in common.md (#985)
bluetarpmedia Feb 19, 2024
c7eccf4
Changes to expressions.md (#986)
bluetarpmedia Feb 19, 2024
eedc605
Another round of docs updates (#983)
gregmarr Feb 19, 2024
4495b65
Add syntax highlighting for inline code blocks using `#!cpp` shebangs
hsutter Feb 19, 2024
9f75d36
Move function calls to expressions
hsutter Feb 19, 2024
ddfa21e
Add capture section
hsutter Feb 19, 2024
84fc3c2
Add Mermaid build diagram
hsutter Feb 19, 2024
430afe0
Add TODO for `member = _;`
hsutter Feb 19, 2024
79252d4
Add interpolation formatting, and other minor cleanup
hsutter Feb 20, 2024
d3b6575
Expand comparisons section
hsutter Feb 20, 2024
f12047a
Update declarations.md (#988)
bluetarpmedia Feb 24, 2024
8d19818
Follow up merge with additional examples, and update highlighted linenos
hsutter Feb 25, 2024
8d49525
Update Capture sections in expressions.md (#987)
bluetarpmedia Feb 25, 2024
f0addd2
More docs reviews (#990)
gregmarr Feb 25, 2024
ecb0031
Add more functions material
hsutter Feb 26, 2024
270fe8f
Changes to functions.md (#998)
bluetarpmedia Feb 27, 2024
b795f31
Fill in some TODO's
hsutter Feb 27, 2024
74fb716
Add requires, namespaces, using, and namespace/type/function/object a…
hsutter Feb 28, 2024
aa9c168
Update aliases.md (#1005)
bluetarpmedia Feb 29, 2024
90f1c83
Add generality notes: Function defaults, and function <-> block/stmt …
hsutter Mar 7, 2024
c62fbbd
Merge previous commit
hsutter Mar 7, 2024
9629009
Merge branch 'docs' of https://github.com/hsutter/cppfront into docs
hsutter Mar 7, 2024
11403c8
Update functions.md (#1011)
bluetarpmedia Mar 8, 2024
5b930e8
Update declarations.md (#1010)
bluetarpmedia Mar 8, 2024
5571100
Complete the metafunctions section
hsutter Mar 9, 2024
1bdab45
Merge branch 'docs' of https://github.com/hsutter/cppfront into docs
hsutter Mar 9, 2024
663b3d0
Update metafunctions.md (#1015)
bluetarpmedia Mar 10, 2024
21d7d43
Add contracts documentation
hsutter Mar 11, 2024
a3986e7
Remove modules documentation stub since that's not supported yet
hsutter Mar 11, 2024
0b40bcc
Fix comment typo
hsutter Mar 11, 2024
162ba1b
Merge branch 'main' into docs
hsutter Mar 11, 2024
a2f37c6
Update contracts.md
bluetarpmedia Mar 11, 2024
55442c2
Merge branch 'main' into patch-11
bluetarpmedia Mar 13, 2024
0a20fef
Merge branch 'main' into patch-11
hsutter Mar 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/cpp2/contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ For example:

``` cpp title="Precondition and postcondition examples" hl_lines="2 3"
insert_at: (container, where: int, val: int)
pre<bounds>( 0 <= where <= vec.ssize(), "position (where)$ is outside 'val'" )
pre<Bounds>( 0 <= where <= container.ssize(), "position (where)$ is outside 'container'" )
post ( container.ssize() == container.ssize()$ + 1 )
= {
_ = container.insert( container.begin()+where, val );
Expand All @@ -42,7 +42,7 @@ In this example:

- The `$` captures are performed before entering the function.

- The precondition is part of the `Bounds` safety contract group and is checked before entering the function. If the check fails, say because `where` is `#!cpp -1`, then `#!cpp cpp2::Bounds.report_violation("position -1 is outside 'val'")` is called.
- The precondition is part of the `Bounds` safety contract group and is checked before entering the function. If the check fails, say because `where` is `#!cpp -1`, then `#!cpp cpp2::Bounds.report_violation("position -1 is outside 'container'")` is called.

- The postcondition is part of the `Default` safety contract group. If the check fails, then `#!cpp cpp2::Default.report_violation()` is called.

Expand All @@ -57,7 +57,7 @@ Contract groups are useful to enable or disable or [set custom handlers](#violat

You can create new contract groups just by creating new objects that have a `.report_violation` function. The object's name is the contract group's name. The object can be at any scope: local, global, or heap.

For example, here are some ways to use contract groups, for convenience using [`cpp2::contract_group`](#violation_handlers) which is a convenient group type:
For example, here are some ways to use contract groups of type [`cpp2::contract_group`](#violation_handlers), which is a convenient group type:

``` cpp title="Using contract groups" hl_lines="1 4 6 10-12"
group_a: cpp2::contract_group = (); // a global group
Expand All @@ -75,7 +75,7 @@ func: () = {
}
```

You can make all the objects in a class hierarchy into a contract group by having a `.report_violation` function in a base class, and then writing contracts in that hierarchy using `<this>` as desired. This technique used in cppfront's own reflection API:
You can make all the objects in a class hierarchy into a contract group by having a `.report_violation` function in a base class, and then writing contracts in that hierarchy using `<this>` as desired. This technique is used in cppfront's own reflection API:

``` cpp title="Example of using 'this' as a contract group, from cppfront 'reflect.h2'" hl_lines="8 9"
function_declaration: @copyable type =
Expand Down