You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider a more commonly-known word than "arity" #1893
Given that Arity has exactly the desired meaning, would it be better to provide a suitable summary comment for people unfamiliar with the term? Part of my concern is that as soon as I see something like Count or Number I expect an integer type, which is incorrect in this instance.
Reacted by Tomáš Kapin, Kent Johnson and James Johnson
I just stumbled upon this issue when checking the API changes (listed in #1891). Since it's open for discussion, I'd like to support the opinion to keep using the term "arity". While this term might not be recognized by many developers (for example by folks who don't have formal mathematical or computer science education), it expresses the entity exactly (see Arity on Wikipedia for reference) and makes perfect sense to people familiar with the term.
Another benefit of using the proper formal term "arity" rather than an approximation is also an educational effect. It expands people's knowledge ("Oh, that's how this thing is called!") and helps to coin the right terminology which in turn results in better understanding between developers.
Reacted by andrewimcclement, Kent Johnson, 4evy, James Johnson and Dave
After reading through #2046 , I'm happy to have a dedicated space (here) to discuss this. I'm afraid I don't have a perfect answer to this question (I suggest a few "less than ideal" possibilities in #2292) , but I very much appreciate the discussion.
I don't think anyone refutes the "correctness" of the term Arity. It's more a problem of "discoverability". By sharing some of the story of how I came to "discover" this property (below), I hope to raise some awareness on the importance of choosing terminology that is "ubiquitous" (any DDD fans?) across the developer community.
I wanted to build a commandline app where the user would be prompted (inquirerjs style) for any arguments not provided
When I began using System.CommandLine (2.0.0-beta4.22272.1), it appeared that ALL arguments were "Required" (as in, you'd get an error if they were missing). I knew that Option had a property called IsRequired, so I looked to see if Argument had a property like that (it did not)
Next I went to a google search for "System.CommandLine optional argument" and came up empty
After deciding that the library must not support what I'm trying to do, I began "hacking around" the problem
I would call GetValueForArgument() and catch the exception thrown if the argument was missing. This lead me to discover an (unrelated) bug and post an issue ParseResultVisitor.ValidateAndConvertArgumentResults returns incorrect value for missing argument #2292 here on github, where one of the helpful contributors mentioned the usage of Arity (which I then had to google). Despite being a software engineer of 15 years, I had never before encountered that term.
If I hadn't discovered a bug, cared enough to dig deeply into the source written a github issue, and gotten lucky when a contibutor responded and "happened" to mention a term I'd never heard before in their response, it's very possible I never would have discovered this property.
I'm also not a fan of the term Cardinality (discussed in the other thread) for the same reasons. This term I've heard of, but not often enough to memorize the definition.
Until I looked at the possible values for Arity, I also did not realize that a single argument accepting multiple values was even a possibility (nor do I fully understand the use case or how that would look in example commands). Would it be something like this (where pepperoni, sausage, ham are modeled as a single argument with Arity = ZeroOrMore)? Can someone help with a real-world example of when this is used?
Parsing similar to ZeroOrMore is usual in Unix utilities that take a list of file names, e.g. cat or ls; it works nicely together with wildcard expansion (globbing) in the shell. Typically though, if the list is empty, then each utility uses some default value instead: cat reads from standard input (like cat -) and ls lists the working directory (like ls .).
Another way to express ArgumentValueCount may be ArgumentVariability, ArgumentFrequency, or as mentioned earlier, ArgumentCardinality. I also have my eye on ArgumentMultiplicy, ArgumentQuantity or simply more correct ArgumentArity. I doubt it that humanity is resilient against learning, when they use "console parsing technology" in their projects.
Activity
reduckted commentedon Nov 11, 2022
What about
ValueCount?KalleOlaviNiemitalo commentedon Feb 28, 2023
Was discussed in #2046 but not decided.
andrewimcclement commentedon Mar 15, 2023
Given that
Arityhas exactly the desired meaning, would it be better to provide a suitable summary comment for people unfamiliar with the term? Part of my concern is that as soon as I see something like Count or Number I expect an integer type, which is incorrect in this instance.tkapin commentedon Aug 23, 2023
I just stumbled upon this issue when checking the API changes (listed in #1891). Since it's open for discussion, I'd like to support the opinion to keep using the term "arity". While this term might not be recognized by many developers (for example by folks who don't have formal mathematical or computer science education), it expresses the entity exactly (see Arity on Wikipedia for reference) and makes perfect sense to people familiar with the term.
Another benefit of using the proper formal term "arity" rather than an approximation is also an educational effect. It expands people's knowledge ("Oh, that's how this thing is called!") and helps to coin the right terminology which in turn results in better understanding between developers.
lukewis commentedon Nov 17, 2023
After reading through #2046 , I'm happy to have a dedicated space (here) to discuss this. I'm afraid I don't have a perfect answer to this question (I suggest a few "less than ideal" possibilities in #2292) , but I very much appreciate the discussion.
I don't think anyone refutes the "correctness" of the term Arity. It's more a problem of "discoverability". By sharing some of the story of how I came to "discover" this property (below), I hope to raise some awareness on the importance of choosing terminology that is "ubiquitous" (any DDD fans?) across the developer community.
If I hadn't discovered a bug, cared enough to dig deeply into the source written a github issue, and gotten lucky when a contibutor responded and "happened" to mention a term I'd never heard before in their response, it's very possible I never would have discovered this property.
I'm also not a fan of the term Cardinality (discussed in the other thread) for the same reasons. This term I've heard of, but not often enough to memorize the definition.
Until I looked at the possible values for Arity, I also did not realize that a single argument accepting multiple values was even a possibility (nor do I fully understand the use case or how that would look in example commands). Would it be something like this (where pepperoni, sausage, ham are modeled as a single argument with Arity = ZeroOrMore)? Can someone help with a real-world example of when this is used?
KalleOlaviNiemitalo commentedon Nov 17, 2023
Parsing similar to ZeroOrMore is usual in Unix utilities that take a list of file names, e.g. cat or ls; it works nicely together with wildcard expansion (globbing) in the shell. Typically though, if the list is empty, then each utility uses some default value instead:
catreads from standard input (likecat -) andlslists the working directory (likels .).teneko commentedon Feb 10, 2025
Another way to express ArgumentValueCount may be ArgumentVariability, ArgumentFrequency, or as mentioned earlier, ArgumentCardinality. I also have my eye on ArgumentMultiplicy, ArgumentQuantity or simply more correct ArgumentArity. I doubt it that humanity is resilient against learning, when they use "console parsing technology" in their projects.