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
Take paymentRequestID in constructor #413
Conversation
We appear to use "?" and "optional" interchangeably to signify nullability in this webIDL definition. Is that intentional or should I convert the whole thing to one way or the other?
The
Then your JavaScript code Suppose your have this IDL instead:
Then your JavaScript code |
Oh, gotcha, makes sense. You asked in the issue for the paymentRequestID to be optional though, which means putting it at the end of the constructor after the options. I don't think this is desirable because my intuition is that many clients will use the paymentRequestID field. Are we okay with it be nullable and at the front of the constructor in order to promote usage? |
👎 to nullable at the front of the constructor, because we don't have the data to backup the intuition of many clients using the new field. Let's use the
|
Oh duh, I have been writing in a one-constructor language for too long :/ |
Shall I go ahead and merge then? Seems like it. |
As long as your newly introduced line-breaks are not reflected in the resulting HTML, LGTM 👍 |
I have no idea how to test that other than to git pull and manually verify. I can remove the line breaks if we prefer a nasty line wrap. |
Line breaks are technically OK if we move |
This should definitely not be merged as-is. It needs to update the constructor algorithm to actually store the paymentRequestID somewhere. |
Good call @domenic, I believe I have address that as well as the spacing from @rsolomakhin. |
@rvm4, I think the paymentRequestID needs to be part of the PaymentDetails object, no? |
[Constructor(sequence<PaymentMethodData> methodData, PaymentDetails details, optional PaymentOptions options), | ||
SecureContext] | ||
[Constructor( | ||
optional DOMString paymentRequestID, |
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 invalid Web IDL to have optional arguments that are not at the end of the parameter list. You'll need multiple [Constructor] annotations, to trigger the overload resolution algorithm. Then you'll need to write two separate constructor algorithms (probably factoring out some shared logic).
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.
We should just add this to PaymentDetails or PaymentOptions.
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'm not a fan of putting it in PaymentDetails or PaymentOptions because it relegates the field to be second class.
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 is second class. It's an optional thing - that's not a value judgement. Making a mess by overloading the constructor doesn't seem very good to me - specially given how complicated it already is to construct these objects.
@@ -556,6 +560,8 @@ | |||
</li> | |||
<li>Let <var>request</var> be a new <a>PaymentRequest</a>. | |||
</li> | |||
<li>Set <var>request</var>.<a>[[\paymentRequestID]]</a> to <var>paymentRequestID</var>. |
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.
OK, so now it is stored with the object. But it is never used by the entire spec, right? You need to wire up the getter for the paymentRequestID property to return the value of the [[paymentRequestID]] internal slot.
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.
Exactly. This ReSpec is also warning that paymentRequestId
is not defined for this exact reason.
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.
Sigh...okay, I can do the multiple constructor thing.
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'd suggest waiting on getting working group consensus on where it should go. It sounds like several people are very much in favor of putting it in PaymetnDetails or PaymentOptions, so any work on making it a separate argument would be wasted.
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.
Yeah, it might be easier/preferable to just put this in PaymentDetails. Any objection to that? Seems like less work. :)
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.
Putting this in payment details will naturally demote the importance of this field. Maybe this should be discussed in the f2f then.
I'm still not sure what you mean by "demotion"? It's an optional parameter with equal importance to any other optional parameter, no? |
Okay, please followup in PR 426 where I moved all this to the details dictionary. |
We appear to use "?" and "optional" interchangeably to signify nullability in this webIDL definition. Is that intentional or should I convert the whole thing to one way or the other?