Skip to main content
Ben Nadel at Scotch On The Rock (SOTR) 2010 (London) with: Andy Bellenie
Ben Nadel at Scotch On The Rock (SOTR) 2010 (London) with: Andy Bellenie

ColdFusion 10 Beta - Critical Bug In Compiling Function Expressions / Closures

By
Published in Comments (26)

The ColdFusion 10 beta was released last Friday. So, naturally, I had to dive in and start experimenting - it was like a second Christmas! I was so excited. The first thing I wanted to explore was probably one of the most controversial features of ColdFusion 10 - Closures and Function Expressions. As I was digging around, I came across a critical bug in the way function expressions get parsed. It appears that a function expression cannot be the first argument in a method that accepts multiple arguments.

A function expression can be the only argument. And, it can be any argument [2..N]. It simply cannot be the first argument of [1..N] arguments. With this current bug, the following code will not parse:

<!---
	Start a CFScript block. Closures can only be used inside
	of CFScript due to the syntax required to define them.
--->
<cfscript>


	// I return any arguments that I received.
	function echoArguments(){

		// Simply return the arguments.
		return( arguments );

	}


	// ------------------------------------------------------ //
	// ------------------------------------------------------ //


	// Demonstrate parsing bug -- function expression cannot be
	// first of N arguments.
	echoArguments(
		function(){
			// Function expression ....
		},
		3
	);


</cfscript>

Trying to run this code will result in the following compile-time error:

Invalid CFML construct found on line 28 at column 18. ColdFusion was looking at the following text: ",".

This is severely critical bug - one that I assume will quickly be fixed before the release of ColdFusion 10. I shall file this immediately in the bug-base.

Want to use code from this post? Check out the license.

Reader Comments

6 Comments

@Ban - I consider u to be fairly intelligent man. A bit horny...but still.

so this Coldfusion obcession blows my mind... Why on earth do u use it when there are so many equal or better free and open source alternatives.....

geezzz...

357 Comments

Sammy, I cannot answer for Ben, but as a ColdFusion user myself (and I should note, I work for Adobe now, so, <biased> alert on), why question Ben's decision to use it? You say there are better solutions out there. Well, better how? People use the tools that make them successful. A tool being open source doesn't make it any easier to use. If Ben can get things done, and done well, in CF (which has been the case for me and many others), then there is no 'better' alternative.

148 Comments

Sammy . . . you might not be aware of Railo or BlueDragon . . . do you count these as being amongst your list of "equal or better free and open source alternatives"?

6 Comments

@Raymond Camden
Well. I honestly don't wanna go into arguing how product A better over B.

the folowing items would be absolutely decisive factor for me:
a) open-source
b) free
c) high market penetration.

So there. Everything else aside if product doesn't meet all of these - I will not use it.

@Lola LB. Developer for 10 years+, still - first time I hear of either Railo or BlueDragon. Puny 133 questions on StackOverflow seem to prove my point - both of these have a tiny marketshare.

57 Comments

Sam, nobody asks questions about Railo and OpenBD on Stack Overflow. (And very few ACF users ask questions there also.)

The mailing lists for both of these however have thousands of threads - in the region of 800-1500 posts every month.

That still might not be the level of "high market penetration" you want, but most of us don't care about that - we care about productivity, and CFML lets us be far more productive than any other language.

6 Comments

@Peter Boughton

1) mailing lists -> every programming language has them so I don't get your point. SO is 1000 times more convenient.

2) productivity - gee - what a coincidence - because productivity is what I care about too and CMFL sucks balls at it.

57 Comments

SO is only more convenient to people that use it.

Some of us would much rather send a quick email than have to go to a website and write something that has a definite answer and wade through nonsense posted by rep hunters whilst having to explain to itchy-fingered mods why it's not the same as an earlier question, etc.

You asked why Ben uses CF - several people have given an answer, which you can either take or leave.

Now you're doing nothing more than attempting to troll, so there's no point wasting further time on you.

6 Comments

@Peter,

yes. CFML has a tiny market share. not open-source and not free. You use it because of as you blurred out "productivity" which is just unprovable set of empty words - otherwise every sane developer would switch to it.

Point taken. thank you.

15,848 Comments

@All,

Please let's not turn this into an argument. I love ColdFusion because it's what I learned, it's how I run my business, and it's how I make money. There's no more magic sauce than that. I am sure that most any other language can do many if not all of the things ColdFusion does. There's no real point in arguing why do what. People love Python. People love Ruby. People love Scala. People love LISP.

I love ColdFusion. She's my baby :)

I've never had a problem with the cost nor with "closed" nature of the software. If those *ever* do become a problem for me, I might consider looking elsewhere. But for now, I'm not looking so solve a problem I don't have.

Come on people, this is supposed to be a joyous exploration of the new features of the language :D Let's remember how awesome programming is.

Programming FTW!!!

52 Comments

@Ben

I found myself a lot negative about CF's prospects in gaining/maintaining a foothold in SMB. Most of the work I've gained ColdFusion-wise in recent years has either been trying to keep legacy CF deployments evergreen, or with customers not particularly concerned with the particulars.

CF10's new feature set has me a lot more excited than I've been. CF9 was such a great move in a good direction, but the new REST capability is so intuitive and exciting.

@Sam

There is no group of people more worthy of being cynical about CF's prospects than long-term CF devs, and yet, there are more than enough people and projects out there to sustain it in spite of what may well be shortcomings. I've been there, and then, all I have to do is play with a public beta like this. I'm getting dollar signs in my eyes thinking of how rapid (and less redundant) building service architectures will be in CF10.

Cynicism ends up being a stain on your soul vs. the people you are trolling. We carry forward, you end up spinning your wheels trying to validate a feeling folks in this forum will never share.

14 Comments

@Sam, not a fan of CF myself but the company I work for uses it and it works for us. If you take the time to look through some of Ben's archives you'll see he is very open to other languages.

@Ben, how the hell do you find time to pick apart CF10 and run a startup?! Your closure posts over the last week must have taken a fair amount of time to write!

383 Comments

@Brian Kresge & @Ben,

a few years back, I had a ColdFusion contract which was supposed to roll into a full-time job. Long story short, the company was sold and the new company that bought out the old one decided not only to not extend to a full-time job, but also not to renew my contract. At the time, I had to move due to personal reasons and had other means of income, so I did not have to "work" in that capacity. During that time, though, for morbid curiosity's sake, I would frequent job boards and for the heck of it apply. During that time, I got a contract with a city doing ColdFusion...they were changing jsp files to ColdFusion files, migrating over their Java/JSP system to a ColdFusion system. I really liked that job, but it was just a contract, which ran out, and for personal reasons, I did not pursue another job for awhile. But when I did, it wasn't a job using ColdFusion per se; I got a job teaching at a local community college. I really enjoyed it, but for reasons related to my personality, teaching in that structure was not for me. So, again, out of a job. I was really not trying to find work when work found me. I got this one job at this company, and did some ColdFusion work there. They did .net, but there was also some ColdFusion work that was being done. While at that job, I got contacted by another employer who wanted to interview and hire me (I had a few resumes floating out there).

I interviewed for that job and got it, and there was a huge decision as to whether leave the job I loved for something that I considered to be a "better opportunity". I ended up going with the career-building "better opportunity". It was a ColdFusion job where I was going to train their employees to use ColdFusion and also change their current system from php to ColdFusion.

The summary version of this story is that there are ColdFusion jobs out there...and tons of them! I have found it hard to stay OUT of a job having a ColdFusion background. I will admit whole-heartedly that it is big-time a regional thing sometimes...when I lived in certain areas, there were fewer ColdFusion opportunities, and I would often have to move to other areas, but there are some areas that have tons of ColdFusion jobs. I get emails pretty much every week with a new job in my field they are hiring in. It may not be in my region, it may require relocation, but I get them constantly...every week.

Currently, where I am at now...I am working and I like my job, but I don't really have to work, and if something were to happen, I don't know that I would pursue "working" (at least doing ColdFusion work) for awhile. I'm thinking I might just take some time off and enjoy myself. :-)

52 Comments

@Anna,

That's great stuff!

I currently work directly in the .NET world, but CF remains something I definitely like to keep the foot in the door with freelancing. Either way, it's the same sort of thing, beating off offers with sticks, but geographically, it's more .NET than CF. Add a DoD security clearance to the mix, and suddenly there's a leg up on government cheese RFPs.

But the freelance work is almost all, around here, maintenance and currency, very little "fresh" work, which is a terrible shame.

All the best, have a great weekend!

383 Comments

@Brian K,

I have had a top secret security clearance also, and I have been told since I have already had one, I could easily get one again with much less effort than someone who has never held one, so it is still considered somewhat of an advantage if I were going to apply for a job that required it. I have been very lucky that there have been times when I haven't had to work necessarily, really. But I agree that if I also had .NET experience, I wouldn't have trouble finding a job either. I know how much of it is out there. There's also just still a lot of ColdFusion, especially geographically, where I live.

52 Comments

@Anna,

That's awesome! I've often lamented that I've gravitated back towards the bucolic/blue collar hybrid point of my own origin - the tech jobs are there, but the really cutting edge work would still would take me to Philly or Baltimore.

SSBI has to be redone every five years since the conditions they follow up on are pretty fluid (travel, credit situation). If you let it lapse, you end up having to redo most of the process, including that awful oral interview, and it *still* takes 6 months to a year to fully get. If there's an expedited process, I've not gotten lucky yet!

I think my ex-wife, who used to work for the NSA as a mil translator, let hers go, because years later, I still had agents follow up with me directly when she reapplied. It's such a hassle all the way around, but worth diligently maintaining if you want to keep that line open.

383 Comments

@Brian K,

I know this sounds weird to a lot of people these days, but I was raised in an environment where it is still highly encouraged that the man works and brings home the bacon and the woman doesn't work...she stays at home and takes care of the house, etc., and I am not completely opposed to that at all. I have never been married, but I have been in very serious relationships where the guy just simply didn't care for me to work, and I was completely fine with that. I don't mind taking a "backseat" so to speak and letting the relationship be like that. At the same time, I realize this isn't a perfect world. In a perfect world, that would work perfectly, and even though the man worked, he would realize the contribution the woman made to keeping the household in order, etc., so he wouldn't hold it over her head or withhold funds from her for "normal" things. Unfortunately, the world is far from perfect, and in those situations, the man does often seem to think that the situation means he has some power over her and doesn't really appreciate her contribution. I'm certainly not complaining or saying I have been in this particular situation, but I have known cases where that was what was going on. I know a lot of women in those particular situations end up feeling trap and hate feeling dependent on that man.

On the one hand, if I were in a relationship with a guy like that or married, I would really moderate my spending. I wouldn't expect him to work hard every day and bring home tons of money just for me to blow and go on shopping trips all the time and spend tons of money. At the same time, he should provide at least for the basics, should give money to me when I need it, for example, to shop for food for the two of us or other BASIC needs, and maybe give me a little extra every now and then to do something I enjoy...maybe a girl's night out at the movies or something like that.

Also, often in this economy and society, a two-income household is an absolute necessity; often, one income is simply not enough to support two or more people, so often, both people HAVE to work. As well, standard of living and the lifestyle you are used to also plays a part in how much is "necessary". For me, don't get me wrong...I really love living the "high" life...going to benefits, dinners, being able to provide and participate in a lot of fun, but costly, activities, but at the same time, I am also the type that can live on very little if I have to, and I don't feel the least bit unsatisfied doing that, either. I really grew up around people who really believe in this type of life...where the man works and the woman takes care of household tasks...probably at least 80% of my female facebook friends are stay-at-home wives and mothers. The women who are married, almost all of them are in that exact situation. Most of my women on my facebook who work are single and work because they have to and don't have anyone to work for them. But I know that's unusual these days.

52 Comments

@Anna,

I know we've talked about it before, but I'm of a religious set that's pretty okay with stay-at-home weemens, but also okay with them working, too. Work or not, that's up to my boo, so to speak.

Where I get concerned is just how seriously underrepresented females are in our vocation, and along with that, I worry about the pay equality. Have you run into any of that? I'd like to believe, of course, that CF is the great equalizer...from Ben's Flickr and the guys at his Epicenter, I feel somewhat gratified to see so many fellow Heebs represented in that niche of the field. Hopefully it's the same way with regards to gender.

383 Comments

@Brian K,

I think your philosophy is best! I am ok w/ the stay-at-home for women thing...I like to work, and don't mind it. I would rather it be a thing I "want to" do instead of a thing I "have to" do. I know a lot of men don't feel they have this option and it is probably viewed as an unfair luxury that some females possess, but it's kind of my viewpoint. I guess that's why it's called work, but it is a luxury I have had at times in my past.

I think the great equalizer, so to speak, is affirmative action, liberals, and the feminist movement. There are some things I don't agree with them on, but I do enjoy the advantage that some employers seem to think it's a good thing I am a woman in this field and want to employ me to even out the numbers, and I'm not going to tell someone they can't hire me because of the fact that they are only doing it because I am a woman. I make more than a lot of the guys I graduated with, and I have made more than some of the male bosses I have had at times. I would love to think it is because of my hard work, work ethics, intelligence and my creditials (and other creditial-based things), but I can't deny the existence of affirmative action. It's worked against me before, so I am completely fine with it working for me for a change. :-)

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel