What should the specification comment syntax be? #872
Replies: 3 comments 5 replies
-
I always assumed the following uses were standard (not exhaustive):
Personally, 4. I would like it to be possible to jump in and out of specs within comments, as that seems like a nice feature to have when you are prototyping. This means Then, answering your points in order, with my points in mind:
I made diagrams a while ago to visualize the comment state machine I was thinking of. I hoped that my above uses would induce a simple state machine, but of course it does not. I'm also not sure if it's complete or correct, but I guess it's a start towards being clearer about these rules. It implements the following ideas:
specification_comments_state_machine1.dot.txt (For this diagram, reading the plain dot might be more informative than the diagram, as the dot is effectively a case distinction over states and inputs) Some ideas we can apply to simplify:
Personally, I think applying all three of above ideas would result in a bit of a clunky to use specification language, but at least it would be easy to implement and explain, which are also nice characteristics to have. If I could decide how to move forward, I would first have a vote in a vercors meeting on the above 3 and other concerns we can formulate concisely, and then go from there. |
Beta Was this translation helpful? Give feedback.
-
My two cents: I think I would prefer it to be quite flexible. So in particular:
So I'm slightly less permissive than Bob (e.g. no line spec nested within line comments). |
Beta Was this translation helpful? Give feedback.
-
Points made during the vercors meeting:
This seems mostly in line with what the JML reference manual suggests (https://www.openjml.org/documentation/, sec. 4.1.3 - 4.1.9). What they have on top of that is the following: JML also allows toggling of modes, there's some business about having spec comments with keys to enable some specs only in some situations, and they define how spec expressions can span multiple line comments. I think we should follow the JML spec up to the stuff vercors doesn't have currently, which is (correct me if I'm wrong) the toggling, specification keys, and having expressions span multiple lines. For all the other stuff we can take the JML manual as a specification. |
Beta Was this translation helpful? Give feedback.
-
I would like to pin down a grammar for specifications in comments. Some things to consider:
@
allowed to start a specifications?@
allowed, required, disallowed at the start of a new line?@
at the end of a block comment allowed, required, disallowed?@
to be mandatory at every line - are line comments then disallowed?@
while in a line comment in a block comment?Beta Was this translation helpful? Give feedback.
All reactions