tracker issue : CF-3643125

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

Suggested revision to savecontent

| View in Tracker

Status/Resolution/Reason: Closed/Deferred/EnhancementRequired

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

Created: 10/01/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: 17

From http://cfmlblog.adamcameron.me/2013/10/suggested-revision-to-savecontent.html

G'day:
I like that <cfsavecontent> is available in CFScript now, but I dislike the clunky way it's been implemented.

The tag version is like this:
<cfsavecontent variable="content">
    <!--- stuff goes here --->
</cfsavecontent>

And the CFScript implemented is a fairly leaden transliteration of that:

savecontent variable="content" {
    // stuff goes here
}

I'm sorry, but this:
variable="content"

is just rubbish.

The construct ought to be:

content = savecontent {
    // stuff goes here
}

That would make more sense, yes?

-- 
Adam

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

Watson Bug ID:	3643125

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

Attachments:

Comments:

This revision would make using savecontent much more natural and intuitive.
Vote by External U.
14397 | October 01, 2013 07:33:31 AM GMT
This revision makes so much more sense. Makes it feel like ECMAScript. Much more natural usage pattern.
Vote by External U.
14398 | October 01, 2013 07:42:47 AM GMT
Me likey. This is much less cumbersome than the current inplementation
Vote by External U.
14399 | October 01, 2013 08:08:19 AM GMT
This would make so much more sense.
Vote by External U.
14400 | October 01, 2013 08:34:14 AM GMT
Absolutely. If cfscript were more consistent in implementation of cf tag functions, not only would it be more intuitive to use but no doubt it would also be used more.
Vote by External U.
14401 | October 01, 2013 08:41:48 AM GMT
It just makes sense to do it right, come on guys. Coding should be intuitive.
Vote by External U.
14402 | October 01, 2013 10:15:09 AM GMT
yep. this would be the smart way to do it... if you want to do it the smart way.
Vote by External U.
14403 | October 01, 2013 10:22:44 AM GMT
Hi all, What if cfsavecontent adds another attribute in the future? Thanks, -Aaron
Comment by External U.
14390 | October 03, 2013 09:30:30 PM GMT
Good point. I suggest: content = saveContent(arg, etc) { // stuff here } But Adobe only have to deal with it when it happens, I s'pose. -- Adam
Comment by External U.
14391 | October 03, 2013 10:40:47 PM GMT
This would make a lot more sense.
Vote by External U.
14404 | October 08, 2013 12:14:31 PM GMT
I have to ask why something that seems to be, essentially, a pretty easy task has now been deferred? I understand that there will be a requirement to support backwards compatibility, but is this really that difficult?
Comment by External U.
14392 | October 09, 2013 07:12:22 AM GMT
This suggested revision makes sense to me.
Vote by External U.
14405 | November 27, 2013 06:41:01 AM GMT
Aaron/Adam: Let's not put the cart before the horse. CFSaveContent has been around how many years now? And with 0 changes... Addition of new attributes seems unlikely at this point.
Comment by External U.
14393 | November 27, 2013 08:47:53 AM GMT
Like I said: "But Adobe only have to deal with it when it happens, I s'pose." -- Adam
Comment by External U.
14394 | November 27, 2013 08:58:06 AM GMT
Actually, a better idea, with more "normal" syntax: http://cfmlblog.adamcameron.me/2014/03/how-about-this-for-savecontent.html {code} contentViaFunction = savecontent(function(){ var decoratedDays = days.map(function(v){ return "<li>#v#</li>"; }); writeOutput("<ul>#decoratedDays.toList('')#</ul>"); }); writeOutput(contentViaFunction); {code}
Comment by External U.
14395 | March 31, 2014 02:18:34 AM GMT
I vote for this syntax: [code] contentViaFunction = savecontent(function(){ var decoratedDays = days.map(function(v){ return "<li>#v#</li>"; }); writeOutput("<ul>#decoratedDays.toList('')#</ul>"); }); writeOutput(contentViaFunction); [/code]
Vote by External U.
14406 | March 31, 2014 01:01:52 PM GMT
This would just make a lot more sense than the current implementation.
Vote by External U.
14407 | June 29, 2015 07:46:51 AM GMT
Yes. I can't believe we missed this the first time around. cfscript's savecontent is just wrong and needs to be fixed.
Vote by External U.
14408 | June 29, 2015 08:24:53 AM GMT
+1 on returning the result rather than the "tag" version of the current implementation.
Comment by External U.
14396 | June 29, 2015 10:20:53 AM GMT
its much cleaner and sensible approach
Vote by External U.
14409 | June 29, 2015 04:18:57 PM GMT
'Nuff said...never did like this way of doing things in script. It's just weird.
Vote by External U.
14410 | June 29, 2015 09:58:06 PM GMT
Would love to see a cleaner implementation.
Vote by External U.
14411 | June 30, 2015 11:15:26 AM GMT
Sweet, maybe... Passionate, I suppose... But don't ever mistake that for nice.
Vote by External U.
14412 | June 30, 2015 12:06:47 PM GMT
A more consistent approach would make a lot more sense.
Vote by External U.
14413 | July 01, 2015 02:07:27 PM GMT