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

Improve Nullable documentation #3114

Merged
merged 1 commit into from Apr 18, 2015
Merged

Conversation

MetaLang
Copy link
Member

  • Add documented unittests for member functions
  • Add new examples
  • Document some behavioural quirks
  • Add Params, Returns and Throws where appropriate

For some reason the alias get this won't show up in the generated DDOC. I guess that must be a bug. Also, is there a way to link to the second "overload" of Nullable in the documentation of the first? I couldn't figure out how to do it.

Check if `this` is in the null state.

Returns:
true $(B iff) `this` is in the null state, otherwise false.
Copy link
Member

Choose a reason for hiding this comment

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

s/iff/if/

edit:

Nevermind, I see now it is intentional.

@MetaLang
Copy link
Member Author

MetaLang commented Apr 5, 2015

I have removed the Throws clause for the time being, but I'm not convinced that it shouldn't be part of the interface of Nullable.get, especially if the check is moved to an in contract. I did not move the check into an in contract as I don't want to change any semantics with this pull, only documentation.

@JakobOvrum
Copy link
Member

The preconditions are part of the interface, but what happens if a precondition is not met should not be.

If a precondition or assert is not met, it is a logic error. We throw various kinds of Errors, but they are not recoverable and not even guaranteed to be catchable. As you mentioned in the docs, they are not even guaranteed to be thrown. It's not useful to limit ourselves to a particular implementation (the sum of the behaviour of both the source code and the compiler) when it doesn't empower the user in any way.

@MetaLang MetaLang force-pushed the nullable-doc-fixes branch 2 times, most recently from 875d0d5 to 1d2d7cb Compare April 9, 2015 22:47
@MetaLang
Copy link
Member Author

Ping

@JakobOvrum
Copy link
Member

LGTM

@JakobOvrum
Copy link
Member

Auto-merge toggled on

JakobOvrum added a commit that referenced this pull request Apr 18, 2015
@JakobOvrum JakobOvrum merged commit ddfd111 into dlang:master Apr 18, 2015
@MetaLang MetaLang deleted the nullable-doc-fixes branch April 18, 2015 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants