Skip to content
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

[AssertExpression] Improve docs #3572

Merged
merged 2 commits into from
Apr 1, 2023
Merged

[AssertExpression] Improve docs #3572

merged 2 commits into from
Apr 1, 2023

Conversation

ntrel
Copy link
Contributor

@ntrel ntrel commented Mar 31, 2023

Change link to use precondition spec in function.dd (contracts spec is a stub).
Fix broken anchor in contracts.dd.
Add class invariant link.
Move compile-time evaluated condition paragraph down to its own subheading (avoid distracting from the runtime evaluation docs which are quite complicated).
Add short example.
Move message argument sentence down to its own subheading.
Reword paragraph about compiler switches. Remove 'continuing execution' list item - that seems to be covered by the first sentence (whether the condition is evaluated or not).
Move best practice section up.
For CT evaluation, avoid mentioning 'release mode' which was undefined.
Add link to static assert.

Add contract and other links.
Move compile-time evaluated condition paragraph down to its own
subheading (avoid distracting from the runtime evaluation docs which are
quite complicated).
Add short example.
Change link to precondition (contracts spec is a stub).
Move second argument sentence down to its own subheading.
Reword paragraph about compiler switches. Remove 'continuing execution'
list item - that seems to be covered by the first sentence (whether the
condition is evaluated or not).
For CT evaluation, avoid mentioning 'release mode' which was undefined.
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @ntrel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

$(H4 $(LNAME2 assert-message, Assert Message))

$(P The second $(I AssignExpression), if present, must be implicitly
convertible to type $(D const(char)[]).

Choose a reason for hiding this comment

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

assert can now have multiple parameters, each of which is converted to string and concatenated. So this sentence should start with "any following AssignExpression, if present, ...

Copy link
Contributor Author

@ntrel ntrel Apr 1, 2023

Choose a reason for hiding this comment

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

@Lyratelle No that only works with static assert. Otherwise dmd would have to link in a runtime function to e.g. convert int to string.

Edit: I suppose dmd could allow multiple arguments for assert if they are all strings, though then you might as well just write concatenations.

@dkorpel dkorpel merged commit b138cc5 into dlang:master Apr 1, 2023
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.

4 participants