First off, I think this is a really great question, and one I am looking at right now too.
Within the context of the code you’ve provided, I would say it does not appear to make any difference. And does not generate an error. But within other contexts, it seems to have a major role. Most notably, if you look at the Persistent Stats Tutorial, they make heavy use of constructors, and say that constructors are required because “Verse persistence does not allow classes containing variable fields to be persistable.” In replicating just a small portion of that code, it will not work without a constructor. See pic.
In it, the UltimateLambda concludes with this:
“If you don’t intend to use a constructor function with other constructor functions, you may be better served with a plain function.”
P.S. I did remove the constructors from the Persistent tutorial example, and it worked with just plain functions as you showed, as long as the return type was manually specified.
This is kinda wrong, it compiles correctly but doesn’t do deep clone when using normal function as constructor as shown in Persistent tutorial example.
Interesting. Is it safe to say then that constructors would be required in the Persistence example and that a plain function would be insufficient? Thanks!
That looks like a bug (I’m making a bug report for it currently). It won’t act at all like the version in an archetype instantiation, but instead will just act like a plain function invocation, producing a new instance of cat with Name as "foo" and Sound as "boo" .