When using cut (!) in code it is sometimes beneficial to add a comment to explain why the cut is there.
After a while one learns that many of the cuts (!) are basically the same.
Recently in looking at source for split/3 the cut has the comment % optimization
and that looks simple enough to explain why the cut is there.
So I was wondering if others have a set of guidelines they use for comments with cuts. I currently don’t have any so my comments for cut are all over the place and that is a bad habit I need to break.
EDIT
Why such a question?
In the old days of coding on keypunch machines there was basically a line and simple short comments.
Then as time evolved developers would add comments for documentation, write some examples, add notes about when or how the method should work, and so on.
If you notice most of those comments are now full blown extensions of the language and related applications, e.g.
Documentation comments → PLDoc, JavaDoc (Comparison of documentation generators)
Method/Predicate examples → Unit testing (SWI-Prolog) (Java) (List of unit testing frameworks)
When to use method/predicate → Attributes, Metadata, RTTI
Works with → Modules