Re: PROPOSAL to close ISSUE-57: TypedLiteralConverter Failures and Exceptions

Toby Inkster wrote:
> On Wed, 10 Nov 2010 20:28:10 -0500
> Manu Sporny <msporny@digitalbazaar.com> wrote:
> 
>> TypedLiteral Conversion Algorithm:
>> If a TypedLiteralConverter is registered for the .type of the
>> typedliteral then try to convert it, if successful return the
>> converted type (for instance a Date) in all other cases (including
>> exceptions) return the TypedLiteral.
> 
> I'd have thought it more useful to return .value in other cases.
> That's how DataContext.convertType works in the current WD.
> 

Then how do you know if it's been converted or not?

options we've got on failure / no registered converter are:

return null; // what if the value should be null?
return tl.value; // how do you know it's failed and the result isn't 
what you're expecting?
return tl; // no conversion happened, no ambiguity

(where tl is an instance of TypedLiteral)

Best,

Nathan

Received on Thursday, 11 November 2010 16:53:12 UTC