-
Notifications
You must be signed in to change notification settings - Fork 264
Added structured types for higer order function parameters #419
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
Conversation
Some function parameters of function type (e.g. handlers, callbacks) was described with the signature in the name-attribute, eg. <argument name="function(index, value)" type="Function">. This have been modified to used nested <argument>-elements to describe the signatures more consistently.
Some callback functions was indicated to receive XMLHttpRequest rather than jsXHR.
The ajaxOptions/ajaxSettings options object is not documented as a seperate type, so now changed to PlainObject. Changed misspelling of jsXHR to jqXHR.
Argument names with whitespace like "jQuery object" are confusing, because it might easily be mistaken for two arguments when reading the signature. Argument names like "-index" are also confusing since they look like an expression rather than a name. I have renamed the argument names to be valid javascript identifiers, just like actual argument names have to be. Also changed argument type "Object" and "PlainObject" to "JQuery" where the prose documentation indicates that the type is a jQuery object.
I took a brief look at this and I like what I see; it's nice to have these functions documented better. I'll take a more thorough look at the individual methods later this week. I wonder if users get that the "=>" means "which should return a", for example This is in the xsl and not your changes, but I'm wondering if we can come up with a better convention before using it across all of jQuery core's docs. The text below the signature explains everything, so maybe this isn't a big deal; but I was confused by the arrow at first. Of course, I bring this up but I don't have a better idea 😄 |
@tjvantoll Isn't colon the most used way to specify the return type of a function? UML uses this convention as well. What do you think? |
|
Personally I don't really like using a colon or a fat arrow. I prefer being wordy, but given the space here, I don't think that's an option. I was mostly wondering whether anyone had a strong opinion here, otherwise we can just leave it as is. |
I don't have a strong opinion either way, but I prefer fat arrow, since I think the meaning is more obvious in the context. |
If we used colon for return value, we should probably be consistent and also use it in arguments also ("name : Type"), as opposed to the Java-like syntax ("Type name") we have now. But either way I think fat arrow is a clearer way to indicate return value. |
If I remember correctly, we did the colon typing for arguments and changed it because people found it confusing. @jzaefferer do you recall that? |
As per discussion on #jquery-content. Also changed type from 'Object' to 'jQuery' where prose indicates a jQuery object.
@@ -21,7 +21,7 @@ | |||
</signature> | |||
<signature> | |||
<added>1.3.2</added> | |||
<argument name="jQuery object" type="jQuery object "> | |||
<argument name="jQueryObject" type="jQuery"> |
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 I'm missing something, but I'm not seeing anything effect of this change.
@esx Thanks a lot for putting this together. I found a few things but they're all pretty minor. Let me know when you've had a chance to go through this and we can move forward with this. |
Some fixes to add missing parameters and naming consistency for callback signatures, based on code review by tjvantoll.
Hi, I fixed the issues you pointed out, except the xslt issue which is in a different project. scottgonzalez explained why I changed the parameter names to valid identifiers: It looks really confusing in the signature documentation when the parameter names contain whitespace or otherwise are invalid identifiers. |
@esx It looks like you still need to add arguments for |
Hi tjvantoll, in commit 6aa5119 I added the extra arguments you pointed out was missing. Or do I misunderstand you? |
@esx Ah ok, sorry about that. I think we're good to go other than the discussion of how to handle callback arguments that can be multiple types. |
The second overload was a bit confusingly specified.
@esx I think we're good other than the change you have for planned for grunt-jquery-content. When you have a pull request for that repo ready please list it here. Thanks. |
Related pull request for grunt-jquery-content: |
Hi, I would like to understand the state of this pull request. Has it been rejected, or are there some outstanding questions that need to be resolved, or something I need to do? |
Apologies. It seems this got lost when the conversation moved to this PR. Your last comment was this:
You fixed the issue in |
I looked through the changes and I found two situations where this comes up:
|
|
+1 for |
Done. |
For I'll clean this up and land it. |
@esx Thanks a lot for making these changes and seeing them through. It's much appreciated. |
I created this issue for using |
Some function parameters of function type (e.g. handlers, callbacks) was
described with the signature in the name-attribute, eg. . This have been modified
to used nested argument-elements to describe the signatures more
consistently.