Re: [WebIDL] Assigning to constants

2008-06-17 Thread Cameron McCormack

Cameron McCormack:
  Yes. The properties set for IDL consts on the interface object, the
  interface prototype object (or corresponding exception ones) should
  all be ReadOnly.  (And the prototype is where the constant comes
  from in the document.documentElement.ELEMENT_NODE case.)

Magnus Kristiansen:
 The last case isn't covered at the moment, since s14 of [[Put]] goes to  
 s24, skipping [[CanPut]] (which is the step that checks prototype chain  
 for readonly). It should instead go to s19.

Over-zealous optimisation on my part (fixed).

 However, at that point it's just doing what would happen at s15, so
 s14 can actually be removed.

Not as of the latest revision, I think?

 And two more issues I noticed:
 - Using an IndexSetter results in a return value (s7), the other returns  
 are void. Copypaste from [[Get]] maybe?

Yeah it shouldn’t be there (fixed).

 - [[HasProperty]] = true (s9-10) should go to s15, since s14 is  
 trivially false. This solves itself if s14 is removed per above.

It’s not false if [[HasProperty]] returned true because the property was
in the prototype chain rather than directly on the object, though.

-- 
Cameron McCormack ≝ http://mcc.id.au/



Re: [WebIDL] Assigning to constants

2008-06-13 Thread Simon Pieters


On Thu, 12 Jun 2008 21:03:31 +0200, Andrew Oakley  
[EMAIL PROTECTED] wrote:



Simon Pieters wrote:

 What should happen when you assign something to a constant? e.g.:
Node.ELEMENT_NODE = 'Hello world';
 Web IDL doesn't say, AFAICT. Firefox and Opera allow the assignment.  
In WebKit it silently fails. I had expected an exception to be thrown,  
just like for readonly attributes.

 It'd be good if this was defined.



http://dev.w3.org/2006/webapi/Binding4DOM/#es-constants says the  
property has attributes { DontDelete }.  That would imply that it  
doesn't have the ReadOnly attribute, and as such the assignment should  
be allowed.


Ok, good that it is defined.

But is there a good reason why it is this way rather than what I'd  
expected (same as readonly attributes)? I think authors should be able to  
rely on constants being, um, constant. No?


--
Simon Pieters
Opera Software



Re: [WebIDL] Assigning to constants

2008-06-13 Thread Maciej Stachowiak



On Jun 13, 2008, at 6:55 PM, Cameron McCormack wrote:



Simon Pieters:

Ok, good that it is defined.

But is there a good reason why it is this way rather than what I'd
expected (same as readonly attributes)? I think authors should be  
able to

rely on constants being, um, constant. No?


It would make sense that way, yes. :)  Since more browsers allowed
overwriting it, I specced it that way.  I have no idea if it is
necessary for web compatibility.  If Moz and Opera people are OK  
with it

being changed to being ReadOnly, I can do that.


Safari has always had these constants ReadOnly and we have not had any  
compatibility issues reported as a result, so far as I know.


If it is not a compatibility issue, I think it makes more sense for  
constants to be constant.


Regards,
Maciej




Re: [WebIDL] Assigning to constants

2008-06-12 Thread Andrew Oakley


Simon Pieters wrote:


What should happen when you assign something to a constant? e.g.:

   Node.ELEMENT_NODE = 'Hello world';

Web IDL doesn't say, AFAICT. Firefox and Opera allow the assignment. In 
WebKit it silently fails. I had expected an exception to be thrown, just 
like for readonly attributes.


It'd be good if this was defined.



http://dev.w3.org/2006/webapi/Binding4DOM/#es-constants says the 
property has attributes { DontDelete }.  That would imply that it 
doesn't have the ReadOnly attribute, and as such the assignment should 
be allowed.





Re: [WebIDL] Assigning to constants

2008-06-12 Thread Bjoern Hoehrmann

* Andrew Oakley wrote:
Simon Pieters wrote:
 
 What should happen when you assign something to a constant? e.g.:
 
Node.ELEMENT_NODE = 'Hello world';
 
 Web IDL doesn't say, AFAICT. Firefox and Opera allow the assignment. In 
 WebKit it silently fails. I had expected an exception to be thrown, just 
 like for readonly attributes.
 
 It'd be good if this was defined.
 

http://dev.w3.org/2006/webapi/Binding4DOM/#es-constants says the 
property has attributes { DontDelete }.  That would imply that it 
doesn't have the ReadOnly attribute, and as such the assignment should 
be allowed.

With ReadOnly setting would be silently ignored, without ReadOnly you
know nothing.
-- 
Björn Höhrmann · mailto:[EMAIL PROTECTED] · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/