Michael,

>s1 = new Object(); s1["camelcase"] = "key is stored in uppercase";
>s2 = new Object(); s2["camelcase"] = "key is stored in camel-case";

Like I said, in the long run I think it's better if case doesn't carry over
and that you just expect the JS keys to be lowercase. 

It gets to confusing when case is sometimes used and not other times. Also,
think about the nightmare of trying to debug this problem:

-- example 1 --
<cfset stPerson = structNew() />
<cfset stPerson["firstName"] = "Jenn" />
<cfset stPerson["lastName"] = "Cole" />

<script>
<cfwddx action="cfml2js" input="#stPerson#" toplevelvariable="stPerson" />
// assuming case was kept
alert(stPerson.firstName + " " + stPerson.lastName);
</script>

Now, let's say you need to overwrite the last name, so you change your code
to:

-- example 2 --
<cfset stPerson = structNew() />
<cfset stPerson["firstName"] = "Jenn" />
<cfset stPerson["lastName"] = "Cole" />

<!---// user changed last name //--->
<cfset stPerson.lastName = "Switzer" />

<script>
<cfwddx action="cfml2js" input="#stPerson#" toplevelvariable="stPerson" />
// assuming case was kept
alert(stPerson.firstName + " " + stPerson.lastName);
</script>

All the sudden your JS is broken. If you look at the code it's not going to
be obvious *why* the code, but all the sudden you're going to be getting JS
errors. The reason is when you set stPerson.lastName, the key's case just
changed from camel-case to uppercase. This would mean that in JS, you'd have
to change the variable to stPerson.lastname.

As much as I like camel-case, that's a mess I don't want to be in again. CF
is a type-less language and is very inconsistent in how it deals w/variable
names internal. 

It makes the most sense that when converting variables from CFML to JS that
it would neutralize case into either all lowercase or all uppercase.

-Dan



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:227342
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

Reply via email to