Thursday 1 October 2015

ColdFusion: language-centric stuff flagged for fixing (for ColdFusion 2016?)

G'day:
Adobe have claimed that ColdFusion 2016 will be a developer-centric exercise, which makes a pleasing change from the PHB-oriented CF11 (well: that can be the only basis for <cfclient> to ever have been considered... some muppet from Adobe polling PBHs for what they want in ColdFusion).

Obviously Adobe are never directly forthcoming as to what's going to go into the next version of ColdFusion, but one can make some inferences from status changes in the bug tracker. There are currently 241 open enhancement requests specifically flagged as "language", and also flagged as "to fix". Obviously there's no promise that 100% of these will go into ColdFusion 2016, but generally stuff they can't be arsed dealing with gets closed with some variation of "nuh-uh" as the closure reason. So perhaps we can think of this list as the target for 2016. Even if they only did half of it, it'll be pretty excellent:



(4058829) Language/Syntax Enhancement - Array/Struct Literal append/update
This is Abram's ticket to add a +, +=, &, &= for complex objects.
(4032723) Add .some() and .every() iteration methods
As the title says: .some() and .every() are handy iteration methods.
(4025814) Add object methods to File objects
Stuff like myFile.read() and File.exists(myFilePath) and that sort of thing
(4022432) Add callback to arraySet()
So instead of setting the array with a static value, one can use a callback to provide dynamic values.
(4022420) make queries implement an array interface
This would make it possible to call any array method on a query object, eg: myQuery.append() etc
(4020372) Arrow functions
This is a short-hand syntax for function expressions: f = (x,y) => x+y;
(4019843) File (objects) should be iterable
Just like one can call .map() and .reduce() etc on an array (etc), one could use the same mechanism for iterating over a file.
(4019842) cfloop over a file should take a file object as much as it should take a path
As the subject says. Currently <cfloop> takes a path; it should also take an already existing file object.
(4010516) Null
We all know about this one.
(4010512) Three-way comparison operator ( <=> ) &amp; Comparable interface
AN operator equivalent of compare(), which is a tri-state function returning -1, 0 or 1 depending on whether the first operand is less than, equal to or greater than the second operand.
(4010501) Futures/Promises
I've already discussed this one ad nauseam (the nausea coming from Acker's thread-hijacking)
(4010446) Cannot catch throwables
One cannot catch an java.lang.Throwable with try/catch. This is kind of a bug, in a way.
(3972123) initmethod is not inherited
Components can specify an alternative initmethod if one does not want to use init(). This is not inherited by sub-components. Also a bug, really.
(3956874) Query of queries where in (select ...) not working
Sub-queries for QoQ!
(3933619) .serializeJson() method not implemented
As in a method on complex objects, as opposed to the procedural function of the same name.
(3927012) Handle automatic type coercion better
This is to add more intelligence to when using a data type in the context a different one is expected. Mostly enhancing the .toString() method on structs etc, and that sort of thing.
(3924625) [ANeff] ER for: canonicalizeURL(inputString, restrictMultiple, restrictMixed[, throwOnError=false])
This is actually a bug canonicalize() doesn't deal with query string params if they are similar to HTML entities.
(3917706) [ANeff] ER for: ISO 8601 support in week()
The week() function doesn't follow ISO-8601 when determining what is week 1 (or maybe week 52/53). Probably more a bug, really.
(3864595) valueList() Query method not implemented
Also a bug IMO. We should be able to go myQuery.valueList("column").
(3863533) [ANeff] Bug for: &lt;cfloop&gt; missing the maxrows attribute (tag-to-script conversion failure)
Also a bug, Aaron ;-)
(3863003) Map|reduce methods on query objects
SSIA: these weren't implemented along with the equivalents on arrays, structs, etc.
(3861322) Improve scalar functions in query of query
This would make QoQ more usable.
(3853251) Array methods: shift(), unshift(), push(), pop(), splice()
Handy array helper functions
(3849074) .duplicate() member function
The method version of the procedural function.
(3844994) [ANeff] ER for: RequestGetMetadata()
Hooks into the RequestMonitor to retrieve request info.
(3844972) Member functions can't be chained to struct/array literals
Struct and array methods often return a pointless boolean instead of the object they just worked on, which sux a bit.
(3842667) Allow exceptions to be nested
Being able to catch one exception, throw another but pass the original exception as a property of the second one.
(3831792) Equality (eq) result is incorrect for some strings with numbers and commas or hyphens
CFML's ubiquitous/perennial struggle with being a loosely-typed language.
(3808978) function expressions do not support annotations
Such as giving them a hint and other meta information.
(3808648) Internal row pointer not correctly implemented in for(row in query)
Sounds like a bug not a feature to me.
(3799243) onRestRequest()
The REST-request equivalent of onRequest(). Because for some reason they don't / won't call onRequest().
(3799027) Allow dynamic case values
Lucee allows dynamic values for case values, so ColdFusion should too.
(3787708) Add assert statement
As per PHP's assert() function
(3765535) new date/time function for returning date/time/datetime in ISO8601
SSIA. Some more support for ISO-8601 behaviour with date/times.
(3754577) cfloop() does not support most of the &lt;cfloop&gt; tag&apos;s functionality
I dunno why this is not a bug, TBH.
(3754490) Add ability to treat strings like collections
One should be able to iterate character by character over a string, using .map(), .reduce(), etc.
(3750732) Custom serialisers just not fit for purpose
I tried to make use of these things, but they're just a bit shit, and need a rethink.
(3749301) Built-in functions as &quot;first class&quot; glitch in function return values
Sounds like a bug!
(3737409) Member functions cannot be called on literals
EG: [1,2,3].each(). I do need to do this sometimes in like unit tests and the like.
(3732993) Separate parameters from SQL in &lt;cfquery&gt;
Same as how one does with queryExecute(). Don't require the params to be embedded in the SQL string (which breeds poor practice IMO), but pass them as a struct or an array in the <cfquery> tag.
(3713323) Iterator methods on query objects have not been implemented
Erm... we already had this one.
(3712167) &lt;cfprocessingdirective&gt; not implemented in CFScript
Well it kinda is. Kinda isn't. And this is a bug.
(3712125) A lot of member functions cannot be chained
This is the same as the earlier one, too.
(3687749) Please add some additional functionality to query of queries in upcoming versions
SSIA, and is covered in other more precise E/Rs too.
(3684150) Add ability to dateAdd() with non-whole-numbers
EG: adding 1.5 days, rather than 36h.
(3680177) Permit types to be &quot;arrays of [things]&quot;
Instead of return types of "array" be able to specify "string[]" or "MyClass[]" etc.
(3648785) Add closure support to blocking operations to alow them to be non-blocking operations.
IE: adding success and failure handlers to long-running file / network operations.
(3648781) Closures cannot be declared outside of cfscript
The should be able to be used in tag-based code. For the sake of completeness
(3644151) Another suggested tweak to CFScript: thread
As per CFML: Another suggested tweak to CFScript: thread.
(3616205) Redefining truthy and falsey values
EG: null, [], {} etc to be false.
(3614456) ==~: regex compare operator
Operator equivalent of reFind().
(3614455) <=>: compare operator
Oops! A duplicate
(3576114) Make the way scopeless variables are handled configurable...
Like Lucee does.
(3555025) Iterators and generators
These are increasingly common in other languages, and would be a good fit for CFML (see "PHP: generators").
(3534476) arraySearch()
Just a rationalisation of the various arrayFind(), arrayContains() functions
(3516706) booleanFormat()
An augmentation of yesNoFormat()
(3499033) New function request: valueArray() to complement valueList()
Same as valueList(), but returns an array.
(3429713) [ANeff] ER for: millisecond() and createDateTime(year,month,day,hour,minute,second,millisecond)
SSIA.
(3429216) [ANeff] ER for: cfloop step precision (date range looping is sometimes imprecise)
Sounds like a bug.
(3427695) CFLOOP over a list should have includeEmptyValues attribute
And another bug.
(3374275) Add granularity to createDateTime()
IE: one could pass a subset of the date parts: just y,m,d; or y,m,d,h etc
(3339105) valueList() should take any expression that evaluates to a query column
valueList() only works with myQuery.myColumn as an argument, and not just an expression which resolves to a query column. Probably more a bug than anything else.
(3198706) Default local scope in variables declared within functions
Oh yes. The way it should have always been.
(3194043) New order attribute for query loops
Being able to reorder a query when looping it.
(3155857) Application.cfc organizational changes
basically being able to specify application settings in onApplicationStart() not the pseudo-contrstuctor.
(3134978) ColdFusion will not support look ahead or look behind regular expressions
I could really use look-behinds in the regex engine.
(3043970) The &lt;cfthrow&gt; tag allows use of an attributeCollection, but the equivalent script method, throw(), throws an exception if you try to use an argumentCollection with it
This is a bug.
(3043502) Add callback support for CFMAIL success or failure
Similar to the earlier one: being able to "fire and forget" a <cfmail> call.
(3043097) As an avid user of <cfstoredproc> and <cfprocparam> I am constantly faced with the amount of effort and code needed to deal with passing NULL values
SSIA.
(3042492) Currently, CFC metadata obtained from getComponentMetadata or getMetadata exposes all properties/etc inherited from a parent object via the "extends" property, which can also recurse up the tree with
This is to "flatten" the metadata into one level, to make it easier to use.
(3041787) [ANeff] ER for: &lt;cfloop name=&quot;&quot; group=&quot;&quot;Example:&lt;cfloop query=&quot;myQuery&quot; group=&quot;myColumn1&quot;&gt; &lt;h1&gt;#myQuery
No idea what this one is about.
(3041263) Function call should be allowed on any expression that yields a function:
EG: s[key]( args )
(3039790) [ANeff] ER for: <cfinsert><cfupdate> really should accept any old struct, not just FORM scope
SSIA. And yes they should.
(3037998) Summary: upgrade CF's regex engine
ApachORO has been dead for a decade. Move on, Adobe.
(3037849) ER for: arrayCollapse()
This would take a sparse array and remove the empty elements
(3037465) ER for: Adding 'ignoreUndefined=""'; attribute to arraySum()
SSIA.

That's a whole lot of language enhancements! There's a mishmash of big and small there, and some stuff than I find really interesting, and some that I'm a bit "meh" about. But the interest levels will vary from dev to dev and requirement to requirement, so it's a good bunch of stuff to target for dealing with.

I do hope Adobe stays true to their (admittedly implied ~) word here.

What you should do, though, is if you like the look of any of these... go and vote for them. The issues with the most votes will be more likely to get implemented. This is a reasonable consideration when Adobe make their selections. Go and vote / comment /etc!

--
Adam