Documenting function syntax (*without* using square brackets)

Status
You're currently viewing only ShuggyCoUk's posts. Click here to go back to viewing the entire thread.
Not open for further replies.

ShuggyCoUk

Ars Legatus Legionis
10,388
Subscriptor++
Just my quickly formed opinion for what it's worth.

One option is to describe it much how you would with the 'ideal' split into separate functions where {n} means super script number refering to a note indicating the rules:
Code:
y = x(A{1},[B],[D])
y = x(A{2},[C],[D])
y,z = x(A{3},[B],[D])
y,z = x(A{4},[C],[D])

Then footnotes 1-n, (if any can be combined do so)
{1} Describe the state of A that controls these scenarios
...
{n} Describe the state of A that controls these scenarios
You could combine the B|C parts, I'm ambivalent on that though because IMO there should be a strong indication that the use of B or C is strongly dependent on the state of A.
This doesn't fully eliminate the combinatorial excess, but it would reduce it somewhat while making it clear that inter dependency between parameters exists.
I would certainly never try to combine two entirely different return types into the same expression, the distinction would always merit a split for me..

Oh and instead of for optional I would just put in
Code:
C = alpha, D = beta
where alpha and beta are the default values as many C like languages do (not sure where the original heritage for that it) but that may not be reasonable to your audience.
 
Status
You're currently viewing only ShuggyCoUk's posts. Click here to go back to viewing the entire thread.
Not open for further replies.