I know there are many users out there who love cfscript and many who really don't care for the syntax. I am really on the fence, I like the syntax but do not use it much because of the lack of support for certain tags and on the presentation layer it just does not mix well for me. One of the main reasons that Adobe is yet to support full scripting is the cfqueryparam tag. I am hoping that in the next version of ColdFusion they find a way to resolve this.
I have been doing some ActionScript 3 development lately and I really love the language. So with that I have a small proposal for CF9 that I am sure some people will be with and some are going to hate it. Day to day I write many Components so I think it would be really cool to write components using scripting. With that said here is an example of what I would like to be able to do.
2
3 variables.dsn = "";
4
5 public function init(String:dsn):User{
6 variables.dsn = arguments.dsn;
7 return this;
8 }
9
10 public function getUsers():query {
11 var q = new cfquery();
12 q.name = "q";
13 q.datasource = variables.dsn;
14 q.sql = "SELECT * FROM Users"
15 q.execute();
16
17 return q;
18 }
19
20 public function getUser(Numeric:id):Struct {
21 var q = new cfquery();
22 q.name = "q";
23 q.datasource = variables.dsn;
24 q.sql = "SELECT * FROM Users WHERE id = " + arguments.id;
25 q.execute();
26
27 return queryRowToStruct(q);
28 }
29
30</cfcomponent>

#1 by Kris Brixon on 3/21/08 - 11:56 AM
<cfcomponent output="false">
<cfscript>
...
</cfscript>
</cfcomponent>
#2 by Dan Wilson on 3/21/08 - 12:31 PM
It would seem that Adobe have begun the process, with allowing attributecollection for every tag... this seems to pave the way for alternate usage of the tags...
Here's to proper scripting support..
DW
#3 by Raymond Camden on 3/21/08 - 12:36 PM
I find this odd. :) If you play with AIR and the sqllite stuff, you can see they support bound query parameters. You use something like (I say siomething like cuz my code isn't in front of me)
sql = "select * from foo where id = :id"
sql.setParam(":id", id)
That syntax is definitely wrong, but close to the idea, and would certainly work for cfscript.
#4 by Dan Vega on 3/21/08 - 12:39 PM
#5 by orangepips on 3/21/08 - 12:51 PM
http://orangepips.instantspot.com/blog/2008/03/21/...
#6 by Dan Vega on 3/21/08 - 1:05 PM
#7 by Gary F on 3/21/08 - 8:38 PM
The cfquery way looks a lot easier/shorter than using a js/c# style scripting language to do the same thing.
#8 by Dan Vega on 3/21/08 - 8:43 PM
#9 by Peter Bell on 3/22/08 - 2:45 PM
Only comment I'd make on the example is there's no reason why there should be a cfcomponent tag around the clas.
#10 by Dan Vega on 3/22/08 - 5:37 PM
#11 by Kurt Wiersma on 3/22/08 - 7:08 PM
#12 by Tony Garcia on 3/22/08 - 10:09 PM
#13 by Dan Vega on 3/22/08 - 10:33 PM
#14 by Raul Riera on 4/9/08 - 9:33 AM
#15 by Dan Vega on 4/9/08 - 9:41 AM
#16 by Bilgehan Mara? on 8/3/08 - 11:14 AM