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

ocean.core.Verify #214

Conversation

mihails-strasuns-sociomantic
Copy link
Contributor

Starting point for #212


module ocean.core.Verify;

import ocean.meta.

Choose a reason for hiding this comment

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

. ?


public void verify ( bool ok, lazy istring msg,
istring file = __FILE__, int line = __LINE__ )
{

Choose a reason for hiding this comment

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

Empty body?

@gavin-norman-sociomantic

Ah parts of the 2nd commit need to be squashed into the 1st.

@codecov
Copy link

codecov bot commented Aug 16, 2017

Codecov Report

Merging #214 into v2.x.x will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           v2.x.x     #214      +/-   ##
==========================================
+ Coverage   68.19%   68.19%   +<.01%     
==========================================
  Files         466      467       +1     
  Lines       40564    40569       +5     
==========================================
+ Hits        27662    27668       +6     
+ Misses      12902    12901       -1

@mihails-strasuns-sociomantic
Copy link
Contributor Author

Oops, should be fixed now.

///
unittest
{
try
Copy link
Contributor

Choose a reason for hiding this comment

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

testThrown?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extra import, thus avoided.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I was just going to say that 👍

Choose a reason for hiding this comment

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

Not really a usage example. I'd remove the ///

be used in place of `assert` freely without introducing cyclic imports.

Copyright:
Copyright (c) 2017 Sociomantic Labs GmbH.
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick, copyright should be verbatim:

        Copyright (c) 2017 sociomantic labs GmbH. All rights reserved

Copy link
Contributor

Choose a reason for hiding this comment

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

(apparently, it's case sensitive)

* `ocean.core.Verify`

New module with a single function, `verify`, intended to serve as drop-in
replacement for `assert` to comply to Sociomantic assert/enforce policies.

Choose a reason for hiding this comment

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

I would explain the reasons for it a bit more, or at least link to the relevant issue where it is explained.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK out assert-vs-enforce guide is not available in public place anywhere. Would be nice to do that so it can be linked.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would https://github.com/sociomantic-tsunami/neptune be a good place for it (or is it purely versioning related)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it is only versioning related. Its README says:

Neptune is a set of guidelines and tools to help developers and users to implement a versioning scheme based on SemVer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, neptune is 100% about out usage of SemVer and related tools. General coding guidelines don't fit there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Former looks applicable 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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


*******************************************************************************/

public class SanityException : Exception

Choose a reason for hiding this comment

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

I don't want to start a bike shed war, but I wonder why you didn't go for ProgrammingException or if there was any discussion about the name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was no specific discussion, I picked the name because I was already using this name in other places to name things with such purpose. I believe it is a more generic and thus correct term than ProgrammingException because cases when we would want to use it may also detect architecture issues or serious violations from trusted input source (like DHT).

@@ -30,6 +30,7 @@ import core.thread;

import ocean.transition;
import ocean.core.Enforce;

Choose a reason for hiding this comment

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

Is enforce still needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, there are also regular exceptions in scheduler.

@mihails-strasuns-sociomantic
Copy link
Contributor Author

mihails-strasuns-sociomantic commented Aug 17, 2017

Updated with a bit more extensive release notes and fixed copyright/ddoc.

@mihails-strasuns-sociomantic
Copy link
Contributor Author

@gavin-norman-sociomantic it was added per your request so please do the honors of final acceptance ;)


New module with a single function, `verify`, intended to serve as drop-in
replacement for `assert` to comply to [Sociomantic assert/enforce
policies](https://github.com/sociomantic-tsunami/sociomantic/blob/master/Code/assert_vs_enforce.md)

Choose a reason for hiding this comment

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

Has this url been discussed? As this is at the top level of sociomantic-tsunami, I would have thought some indication of which programming language this relates to would be good.

Choose a reason for hiding this comment

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

We'll need to adapt the guidelines to specifically address usage of assert vs enforce vs verify, but we can do that later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Has this url been discussed?

I expected to get some suggestion how to name it from @dylan-cromwell-sociomantic but he merged it with this URL :P

Adapting guideline is planned after this is merged.

Choose a reason for hiding this comment

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

he merged it with this URL :P

404, though...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, md vs rst. Updating.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Choose a reason for hiding this comment

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

@mihails-strasuns-sociomantic @gavin-norman-sociomantic normally I would take more time to discuss the structure but I trust your judgement and simply don't have the bandwidth right now. Please do propose a language-based structure if need be.

Choose a reason for hiding this comment

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

👍 We can discuss a better structure. The main thing is that we have it in tsunami now.

Choose a reason for hiding this comment

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

Yup, awesome. I think that relying on me (one person) for reviewing structure of things even in that single repo is going to be too much of a bottleneck considering that we would want me to continue to focus on the overall strategy and setup of the program itself. But of course, if you like to discuss or need any feedback at all, I am super happy to comply, just poke me!

@gavin-norman-sociomantic gavin-norman-sociomantic merged commit 9985e44 into sociomantic-tsunami:v2.x.x Aug 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants