- From: Dimitry Golubovsky <golubovsky@gmail.com>
- Date: Thu, 28 Jan 2010 14:19:37 -0500
- To: Dominique Hazael-Massieux <dom@w3.org>
- Cc: public-script-coord@w3.org
Hi, Deep IMHO, from the stronger typing standpoint, nullable types are good. They are like Maybe in Haskell where a value that can contain "failure" (null) is distinct from value that cannot fail. One has to perform some action to convert the former to the latter, reasonably providing a substitute for null (or avoiding some action if the value happens to be null). Then, if an operation/method accepts a value that is ensured at the type level not to be null, multiple checks for null are not necessary: the code becomes simpler. Dominique Hazael-Massieux <dom@w3.org> wrote: > Arguably, this is something that can be fixed in the Contacts API, but > before submitting the bug report, I was wondering what was the rationale > for forbidding the use of "?" on interface types; in particular: > • why interface types include the null value? They should not. An operation that possibly fails has to return nullable type e. g. getElementById could be Element? getElementById(in DOMString elementId); declaring that it may return no element (fail). -- Dimitry Golubovsky Anywhere on the Web
Received on Thursday, 28 January 2010 19:20:12 UTC