Status/Resolution/Reason: Closed/Won't Fix/
Reporter/Name(from Bugbase): Walter Seethaler / Walter Seethaler (Walter Seethaler)
Created: 06/24/2011
Components: Language
Versions: 10.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Trivial / Unknown
Locale/System: English / Platforms All
Vote Count: 0
Problem:
I hit on the topic when I tried to port some Java code to CF. The Javadoc comments statet very often:"Returns NULL if XYZ is not found"This would be very helpful in ColdFusion, too. Example (cfscript):interface{ import storage.basket.Apple; /** * This method returns NULL if no big apple is found. */ Apple function findBigApple();}Without the possibility to return NULL ("return;"/"<cfreturn />) it is hard to implement the case, where no big apple is found. To throw an exception feels weird.As Ben proved (http://www.bennadel.com/blog/1654-Learning-ColdFusion-9-IsNull-And-Working-With-NULL-Values.htm) this should be compatible with the new isNull() method.
Method:
Result:
A interface or class of the form: <cffunction name="getApple" returntype="Apple">should be able to make three things:1. Return a object of type "Apple"2. Throw an exception.and (not possible yet)3. Return NULL (<cfreturn />)In case 3. ColdFusion raises an error now, because "<cfreturn />"/NULL is not of type "Apple".Case 3 is possible in Java and would help to write better code (see details).
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3043878
External Customer Info:
External Company:
External Customer Name: Walter Seethaler
External Customer Email: 1564196048D964A0992015A7
External Test Config: 06/24/2011
Attachments:
Comments: