tracker issue : CF-3687548

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

Allow the type of variables to be specified

| View in Tracker

Status/Resolution/Reason: Closed/Deferred/EnhancementRequired

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

Created: 12/23/2013

Components: Language

Versions: 10.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: Final /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Platforms All

Vote Count: 3

It would be good to be able to do this:

<cfset int myInt = 42>

And have CF treat that *as an int*, thereafter. myInt can only take another int as a value, it can only be used for int-type operations, needs to be specifically cast to another type if need be.

Sometimes it's great to be loosely typed. SOmetimes it's a real pain in the arse to be so flippant with data typing.

Over and above that, often CF makes some poor decisions as to how best to store values, so being able to coerce it would be very bloody useful.


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

Watson Bug ID:	3687548

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



+1. Being able to enforce variable types when needed would be very helpful. Loose typing is great 95% of the time - but the other 5% it's a huge PITA.
Vote by External U.
13805 | December 23, 2013 03:25:56 PM GMT
I agree. To me, the best implementation is to allow the user to indicate to ColdFusion that they want strict typing vs. loose, and it will provide errors accordingly.
Vote by External U.
13806 | December 24, 2013 09:38:32 AM GMT
I appreciate this probably isn't a small task but it would be amazingly useful in some situations.
Vote by External U.
13807 | December 31, 2013 06:34:48 AM GMT
This needs a much wider discussion whether CFML needs to be strongly typed. Parking it for the time being.
Comment by Rupesh K.
13802 | May 02, 2014 10:11:04 PM GMT
Fair enough. Make sure to involve the broader community in the discussions though, eh? Not just the "special" people in the CAB / PR Programme. I think there are more well-informed opinions outside those groups than inside, if I'm to be blunt about it (and I don't just mean "mine", when I say that ;-). -- Adam
Comment by External U.
13803 | May 03, 2014 03:27:50 AM GMT
Please re-triage for CF12.
Comment by External U.
13804 | June 20, 2015 05:13:21 AM GMT