syntax question i guess i've never noticed before....
# lucee
e
syntax question i guess i've never noticed before. If i have a function with an argument of type struct, can i not default it to an empty struct {} ?
Copy code
<cfargument name="keywordSearchConfig" type="struct" required="no" default={}>

Argument [keywordSearchConfig] is of invalid type, Cannot cast String [{}] to a value of type [struct]
w
<cfargument name="keywordSearchConfig" type="struct" required="no" default="#{}#">
cfscript syntax is a bit more forgiving than that
e
ha! one of the few times i would have expected the string eval not to work for some reason, thanks!
d
You can also use structNew()
z
https://luceeserver.atlassian.net/browse/LDEV-801 with 7 cfproperty no longer only supports simple types for defaults
Settings - Language/Compiler
e
@zackster nice! i always though it was an odd design choice that a variable had to be evaluated in quotes in that context
z
Backwards Compatibility
b
In tags, all unquoted attributes are taken as strings.
Interesting to see Lucee 7 has a switch for that. I know a lot of legacy code uses that.
z
Been there since ages