First, a huge thank-you to Andy for taking on the task of implementing
the implicit array/struct creation and additional operators. I
predominantly write my code in cfscript so I was extremely happy to
see these additions (as well as the new ANTLR-based parser) added to
Open BlueDragon. I must say these were my most missed features of the
language after "leaving" Adobe CF.
No time like the present so I started using the new features this
morning and ran into a few unexpected results. I am not too sure if
the issues are due to my misunderstanding of the new implicit struct
creation or my expectations per Adobe CF8's implementation (which as
far as I know could be flawed itself, wouldn't surprise me).
What I am trying to do is create a struct implicitly using key values
that are other variables. Take for example my following code:
<cfscript>
variables.aStrVar = 'my test string';
variables.stTest_1 = {key1 = 'my test string'};
variables.stTest_2 = {key1 = aStrVar};
variables.stTest_3 = {key1 = '#aStrVar#'};
// variables.stTest_4 = {key1 = #aStrVar#};
// variables.stTest_5 = {key1 = variables.aStrVar};
// variables.stTest_6 = {key1 = #variables.aStrVar#};
// variables.stTest_7 = {key1 = '#variables.aStrVar#'};
</cfscript>
<cfoutput>Test string: #aStrVar#</cfoutput><br/>
<cfdump var="#stTest_1#">
<cfdump var="#stTest_2#">
<cfdump var="#stTest_3#"><!---
<cfdump var="#stTest_4#">
<cfdump var="#stTest_5#">
<cfdump var="#stTest_6#">
<cfdump var="#stTest_7#"> --->
The first struct is created without issue since I am defining the
string along with the key name. The second and third struct
declarations do not throw errors however they create a key value of a
zero length string. Struct test cases 4-7 throw server errors (bad
file exception: Problem occurred while parsing: Encountered invalid
token after "#").
Since this functionality is new in Open BD I am not too sure if this
is a defect or if it is not how implicit declarations are normally
executed and how they are handled on this platform. I would be curious
what other folks experiences have been and if the proper convention
for OpenBD only supports non variables assignment.
Thanks again for the work Andy!
Kind regards,
-JSLucido
--
Open BlueDragon Public Mailing List
http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
mailing list - http://groups.google.com/group/openbd?hl=en
!! save a network - please trim replies before posting !!