Feedback requested on returning null/void or throwing an exception

Hi All,

We've came across a situation in the RDFa API which could do with some 
input from the webapps group, primarily on the WebIDL side of things.

We have the following interface:

[NoInterfaceObject]
interface TypedLiteral : RDFNode {
     readonly attribute stringifier DOMString value;
     readonly attribute IRI                   type;
     any valueOf ();
};

If a converter is registered with the API for the specific `type` then 
valueOf() returns the native type (for instance Date in the case of 
xsd:dateTime).

We are currently looking for input on what valueOf() should return when 
there is no converter registered. Choices we're looking at are:

  1: unconverted value
  2: throw an exception
  3: return null
  4: return void

1 and 2 aren't really any option tbh - 3 I prefer, 4 another member of 
the WG prefers, but primarily we're looking for best practise in this 
scenario, and whether 4 is even an option.

Best and TIA,

Nathan

Received on Thursday, 28 October 2010 18:47:18 UTC