If you redundantly define a record as in cmd_bad:
You get this:
You defined that last one incorrectly...
local cmd_bad = Exec::Command([$cmd=strcmd]);
The square brackets create a record and then you're doing the named ctor thing, so it's a record in a record. Am I misunderstanding something?
Oh, yes, I know it's wrong. I was helping someone on IRC and they made that mistake.
The issue is how is that not a syntax error and how does it somehow set cmd to "[cmd=echo hi]"?
It's coercing the record in to a string (the type of the first field) where I would expect there might be some type check that could emit an error instead. I'll see if it's an easy fix to do during beta.
The expression list given to a record ctor may currently be comprised of record-field-assignment expressions or any expressions that evaluate in to a record. For all the expressions in the later case, their record fields will get incorporated in to the type of the outer record ctor. Or at least that's what supposed to happen, except the code currently doesn't work if there's more than one such expression.
In light of that, I'm going to change record ctor's expression list to only allow record-field-assignments (which fixes the issue in this ticket). No default scripts rely on the other functionality, which appears to be a relict, and I don't see the use of a record ctor that takes a single expression which evaluates in to a record (you can just use that expression instead of the ctor).