This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html Multipage: http://www.whatwg.org/C#client-identification Complete: http://www.whatwg.org/c#client-identification Comment: String constant on NavigatorID is invalid per WebIDL Posted from: 81.242.195.27 by ms2ger@gmail.com User agent: Mozilla/5.0 (X11; Linux x86_64; rv:22.0) Gecko/20130301 Firefox/22.0
Either make it a simple readonly attribute or make Cameron allow it, I guess.
heycam, let's allow it! :-D This relates to the last interesting line of this IDL block: [NoInterfaceObject] interface NavigatorID { readonly attribute DOMString appName; readonly attribute DOMString appVersion; readonly attribute DOMString platform; readonly attribute DOMString userAgent; const DOMString product = "Gecko"; // for historical reasons };
Constants appear on both the interface object and on the prototype. In this case, there's no interface object because of [NoInterfaceObject], but it still seems wrong conceptually to use a constant for .product.
If there was some WebIDL way of defining an attribute that always returned a single value but didn't appear on the prototype, that would be even better. I agree that the type of constant that appears on the interface isn't what I'm looking for here.
static const DOMString product = "Gecko"; // for historical reasons ? /be
static attributes already exist, if you were happy to to do the 'Return "Gecko".` bit in prose. Otherwise static const seems reasonable to me. And probably preferable, since it would result in a data property rather than an accessor property. I don't understand the objection to use a constant if the value is indeed constant, by the way.
The attribute should only be on the prototype, not on the interface object. static does the opposite. I think what is requested here is the equivalent of [[ interface Foo { readonly attribute DOMString product; }; The `product` attribute must return the string "Gecko". ]] Since this is a legacy feature, I'm not convinced WebIDL should support dedicated syntax for it.
Yeah I'm just trying to avoid having prose for this legacy feature, the same way that people keep having me avoid prose where I can avoid it by using other features like defaults for optional arguments, enums, etc. :-) heycam: If you don't want to support this, just reassign it to me and I'll use prose.
I understand the desire to avoid writing prose, but I don't understand why we'd want string constants in IDL.
FYI, I don't need this for HTML anymore. I made it all prose.
WONTFIX since nobody came up with a compelling use case.