tracker issue : CF-3042895

select a category, or use search below
(searches all categories and all time range)

Bug 85247:It would be nice if CF had a built-in function called Null() or None() which would return a special object (like struct/array) that can be used

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/

Reporter/Name(from Bugbase): Eric Twilegar / Eric Twilegar (twillerror)

Created: 11/30/2010

Components: Language

Versions: 10.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 /

Priority/Frequency: Normal / Most users will encounter

Locale/System: English / Platforms All

Vote Count: 1


It would be nice if CF had a built-in function called Null() or None() which would return a special object (like struct/array) that can be used. However, to be more CF like it should act more like an empty string. If you try to append this object to a string it simply appends an empty string. If you call Len() on the object it returns 0.Tags like cfqueryparam though if the Null object is plopped into the value="" attribute it would auto use NULL for the db parameter.For arguments you could specify that the value can or cannot be NULL. By default I guess it wouldn't take it. Also, we might consider placing a "ignoreNULL" attribute on cfarguments. If this is set to Yes (no is the default of course ) then the function will behave as if the value was never passed in.isSimpleValue would return true for this object type.A new function called isNullObject or re-use isNULL() would return true.The point is there are a few edge cases where NULL/None would be very usefful. For Java integration, for SQL, and in some cases the ability to pass a value to a function that is equivalent to not passing the argument at all....At the minimum it would be nice if you could do this.<cfset someFunc( someArg = NONE ) and have that behave as if you didn't have someArg as an argument at all.This should really be a seperate ticket, but while I'm on the subject this would be superful useful as well.<cfset someFunc( someArg = DEFAULT ) so that you can specify to use the default.There are many cases when I call functions and want to have slighlyt different calls but it can be hard unless I use argument collection.Thanks,Eric


Add special Null/None object that behaves like an empty string, but it testable and used by <cfqueryparam> and optionsally by cfargument.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3042895

External Customer Info:
External Company:  
External Customer Name: Eric Twilegar
External Customer Email: 3D9A02F5446CCE0A992015D5
External Test Config: 11/30/2010



Dunno why this is "never fix". CF needs the concept of NULL. I wouldn't make it a function though, I'd just make it a keyword. You know: like most other languages have. -- Adam
Vote by External U.
21301 | August 29, 2012 02:05:41 AM GMT
Adobe, can you pls explain your "neverfix" rationale here pls? It's a bit more courteous than simply closing the ticket. -- Adam
Comment by External U.
21300 | June 11, 2014 04:39:19 AM GMT