portal entry

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

Quick thoughts on structs

| View in Portal
June 06, 2019 04:22:05 PM GMT
<p>Three kinds of structs in ColdFusion</p>
<p>The post <a rel="nofollow" href="https://coldfusion.adobe.com/2019/06/quick-thoughts-structs/">Quick thoughts on structs</a> appeared first on <a rel="nofollow" href="https://coldfusion.adobe.com">ColdFusion</a>.</p>
Labels: Blog, ColdFusion, Modern CFML, blog, modern cfml, Variables


Nice and handy!
Comment by David Byers
2091 | June 07, 2019 04:14:43 AM GMT
<p>I get different result from the cffiddle.</p><p>what’s the difference between </p><p>a = [:] ;</p><p>and</p><p>a = StructNew(“ordered”, “text”); </p><p>can't find documentation for how to use [:] in ColdFusion</p><p> </p><p> </p>
Comment by oliver leung
2104 | June 07, 2019 11:32:28 PM GMT
What do you see as the biggest benefits of using a struct over just a list?
Comment by rcasdorph
2506 | November 05, 2019 09:07:31 PM GMT
This is a tough one. I can think of quite a few off the top of my head <ol> <li>It is structured data as opposed to a way of interpreting a string</li> <li>Keys and values are discrete</li> <li>All kinds of member functions associated with it</li> <li>They naturally work with JSON</li> <li>They are naturally a part of the core language. Form, url, request, etc. scopes</li> <li>writedump() a struct is much cleaner to read than list</li> <li>Items in a list can't have commas. Structs don't care</li> </ol> Even after writing these, I am sure there are others. Lists have their charms too. When doing a form submit with checkboxes, you get lists. When querying a DB, sometimes they want lists.
Comment by James Mohler
2513 | November 06, 2019 04:34:39 PM GMT