I do see your point... and further, I still disagree...
With all due respect, && is the AND comparison operator.
And == is the IS comparison operator.
My point was that JS isn't all that hard to read and write once you learn it.
My new point is that if all languages were as easy to write as CF, the
world would be a very boring place. It's kind of like asserting that
the world would be a better place if everyone spoke English, and
nothing but English. Sounds kinda blah. Especially since other
languages contain idiomatic expressions that convey a nuance that's
impossible to convey in English, as English does with some things that
other languages don't.
+= would be a nice operator to have in CF... and yet it must be said
with i=1+1... hence some things are easier to write in JS than in CF.
And for me, often, I'd *rather* use JS-style syntax in CFSCRIPT. Why?
Because the JS syntax is more concise, and in general faster (though
CFSCRIPT no longer provides better performance per se, the concise
code it can produce reduces the code written under some
circumstances).
Also, your example isn't entirely fair, because you left out the whole
example in CF and wrote the whole example in JS:
<table>
<cfloop condition="i LTE arrayLen(g)">
<cfset calpercentage = round(g[i][1]*100/total)>
<cfset calwidth = round(gwidth*(calpercentage*100))
<cfoutput>
<tr><td>#round(g[i][0])#</td><td><img src="#graphimage#"
width="#calwidth#" height="10">#calpercentage#%</td></tr>
</cfoutput>
<cfset i = i+1>
</cfloop>
</table>
And, if someone wanted to use cfscript for this task, it could be done
exactly as JS does it with very minimal alterations:
<cfscript>
output = "<table>";
while (i lte arrayLen(g)) {
calpercentage = round(g[i][1]*100/total);
calwidth = round(gwidth*(calpercentage*100));
output = output & "<tr><td>" & round(g[i][0]) & "</td><td><img
src='" & graphimage & "' width='" & calwidth & "' height='10'>" &
calpercentage & "%</td></tr>";
}
output = output & "</table>";
writeOutput(output);
</cfscript>
So, it's not so simple as CF is a more natural language... were it not
for Java, which looks almost exactly like JS, there WOULD BE no CF.
And had it not been for C++, which was the original language that CF
was written in, it would never have gotten started at all. CF is a
high-level productivity-layer language that works well for its
appointed tasks, and yeah, it might be great if everything worked that
way... but I doubt it. Since, if nothing else, there's a certain
amount of overhead that goes with turning human-readable code into
machine-executable code, there would probably be a huge cost involved
at runtime... whereas since CF is built in layers, the underlying
layers are very close to the surface and provide that conversion quite
quickly AND only once, in general, because it's only recompliled when
changes are made (generally speaking).
Anyway, I find other programming languages as fascinating as I do
other human languages, and think the landscape would be barren and
ugly without them.
Laterz,
J
On Sun, 27 Mar 2005 05:46:26 -0400, Will Tomlinson <[EMAIL PROTECTED]> wrote:
> >But Will...
> >
> >JS is client-side, and CF is server-side...
> >
> >The whole universe could convert to CF (and I'd probably be out of a
> >job!) and we'd still need JS or something like it (unless, with the
> >mass conversion, MM created a CF-based browser that could use CF
>
> With all due respect you missed my point. Or maybe I didn't make it clear. It
> wasnt to get rid of JS, but rather for it to written as easily as CF. CF
> makes sense.
>
> <cfif getquery.theID EQ "blablah">
> do this
> </cfif>
>
> The same thing in JS goes somethin like this.
>
> for (i=0;i<g.length;i++)
> total+=parseInt(g[i][1])
>
> output='<table border="0" cellspacing="0" cellpadding="0">'
> for (i=0;i<g.length;i++){
> calpercentage=Math.round(g[i][1]*100/total)
> calwidth=Math.round(gwidth*(calpercentage/100))
> output+='<tr><td>'+g[i][0]+'&nbsp;</td><td><img src="'+graphimage+'"
> width="'+calwidth+'" height="10"> '+calpercentage+'%</td></tr>'
> }
> output+='</table>'
> document.write(output+'<br>Total participants: <b>'+total+'</b>')
>
> Ok, so I exaggerated, but who's the numb skull that came up with ++ and &&??
> And ==?
>
> My point is it'd just make life easier if the same creative minds that
> engineered CF to be written much like english also engineered the others.
>
> :)
>
> Will
--
Continuum Media Group LLC
Burnsville, MN 55337
http://www.web-relevant.com
http://www.web-relevant.com/blogs/cfobjective
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200134
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54