- From: Simon Pieters <simonp@opera.com>
- Date: Fri, 13 Nov 2009 11:59:47 +0100
- To: Steffen Krüssel <steffen.kruessel@googlemail.com>, public-webapps@w3.org
On Fri, 13 Nov 2009 11:03:35 +0100, Steffen Krüssel
<steffen.kruessel@googlemail.com> wrote:
> Hi all,
>
> I do not know exactly if this issue/question was already discussed on
> this
> ML, but I didn't find anything in the archive that made it clear.
>
> I'm writing an interface, which has an operation that takes multiple
> attributes. However, the last attribute is "quasi-optional" and should be
> replaced by a "default value" if the user does not set it in the
> interface
> call.
>
> Here is an example (just to make clear my intention):
>
> interface textbox {
> // while text is mandatory, the color can be set optionally and if not
> set
> to black/0 (default)
> void setText(in DOMString text, in unsigned long long color)
> }
>
> If calling
> textbox.setText("test");
> the color attribute should "per default" be set to black/0, which should
> (in
> my understanding) be specified in the IDL, shouldn't it?
>
> So, the question is if this behavior can/should be formally specified
> with
> the help of WebIDL or if it is not a functional part at all.
I think you want something like:
interface textbox {
void setText(in DOMString text, in optional unsigned long long
color); // why long long?
}
When the color argument is omitted, the default value of black/0 must
be used.
> Thanks and regards
> Steffen Krüssel
>
> PS: The behavior seems to me a bit similar to what [[TreatNullAs]] and
> [[TreatUndefinedAs]] respectively (but not restricted to DOMString
> arguments).
--
Simon Pieters
Opera Software
Received on Friday, 13 November 2009 11:26:30 UTC