Lucee 7 CFPROPERTY improvements

Lucee 7 address some long standing annoyances with CFPROPERTY

<cfscript>
myCfc = new component accessors="true" {
  property name="foo" type="string";
  property name="bar" type="numeric";
  property name="arr" type="array" default="#[1,2,3]#";
  property name="st" type="struct" default="#{lucee:"rocks"}#";
  foo = "hello";
  bar = 42;
};
dump(myCfc); // See CFC object with properties
jsonString = serializeJson(var=myCfc, compact=false);
writeOutput(jsonString); // Output: {"foo":"hello","bar":42}
</cfscript>

image

7 Likes

But after testing, due to frameworks (i.e. preside) overriding the default values, the type validation has been reverted

https://luceeserver.atlassian.net/browse/LDEV-5816?focusedCommentId=64767