-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support TypeSignature::Nullary #13354
Conversation
Signed-off-by: jayzhan211 <[email protected]>
@@ -135,6 +134,8 @@ pub enum TypeSignature { | |||
/// Null is considerd as `Utf8` by default | |||
/// Dictionary with string value type is also handled. | |||
String(usize), | |||
/// Zero argument | |||
ZeroArg, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe NoArgs would be more explanatory? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the difference 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its choice of wording yes. Another option we can take from https://en.wikipedia.org/wiki/Arity and name it Nullary to be in sync with unary, binary functions we already use.
I think it would be nice to support a signature defined by something like |
|
Signed-off-by: jayzhan211 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm thanks @jayzhan211 👍
Signed-off-by: jayzhan211 <[email protected]>
Signed-off-by: jayzhan211 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great to have only one case for defining a signature with zero arguments. This will make it easier to use and less error-prone.
(Though I think "ZeroArg" or "NoArg" would be slightly more friendly for non-native English speakers)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it! Thanks @jayzhan211
Thanks @2010YOUY01 and @comphead for review. |
* support zero arg Signed-off-by: jayzhan211 <[email protected]> * rename to nullary Signed-off-by: jayzhan211 <[email protected]> * rename Signed-off-by: jayzhan211 <[email protected]> * tostring Signed-off-by: jayzhan211 <[email protected]> --------- Signed-off-by: jayzhan211 <[email protected]>
BTW I hit a usability rough edge due to this change I think: |
@@ -135,6 +134,8 @@ pub enum TypeSignature { | |||
/// Null is considerd as `Utf8` by default | |||
/// Dictionary with string value type is also handled. | |||
String(usize), | |||
/// Zero argument | |||
NullAry, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the A
here intended to be upper-case? I'd have expected Nullary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nullary
looks good to me too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which issue does this PR close?
Closes #.
Rationale for this change
Currently there are uniform(0), any(0), exact(0) 3 ways to describe zero argument signature. To avoid confusion, add
TypeSignature::ZeroArg
and disable 0 argument for those 3 signatures, they now require at least one argument.What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?