W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2010

Feedback requested on returning null/void or throwing an exception

From: Nathan <nathan@webr3.org>
Date: Thu, 28 Oct 2010 19:46:06 +0100
Message-ID: <4CC9C4EE.4090406@webr3.org>
To: public-webapps <public-webapps@w3.org>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:41 GMT