tracker issue : CF-3927012

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

Handle automatic type coercion better

| View in Tracker

Status/Resolution/Reason: To Fix//

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 01/24/2015

Components: Language

Versions: 11.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Platforms All

Vote Count: 1

It'd be excellent if structs, arrays and other complex types had a toString() method which was called automatically if an object of this type is used as a string. The default behaviour could be to serialise to JSON, perhaps, eg:

person = {firstName="Zachary", lastName="Cameron Lynch"};
writeOutput("My son is #person#"); // My son is {"lastName":"Cameron Lynch","firstName":"Zachary"}

Better yet would be to be able to specify a CFC, Struct.cfc (in the root of the app? In a lib dir? As a setting in Application.cfc?) which implements an interface which provides for methods like toString(), toNumeric(), etc, which are then used when using a struct as [one of those types].

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

Watson Bug ID:	3927012

External Customer Info:
External Company:  
External Customer Name: Adam
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

+1 - That would be handy ...........
Vote by External U.
8809 | January 29, 2015 05:38:54 AM GMT
There are a couple of variations mentioned in the ticket description. Can you pls elaborate on what's the plan "tofix"?
Comment by External U.
8807 | August 19, 2015 12:15:57 AM GMT
Hello? Can you please confirm in what version of ColdFusion this is going to be implemented in. It says "to fix" but does not say which version.
Comment by External U.
8808 | January 25, 2016 08:21:33 AM GMT