Support assignment to properties of object arrays #42
Labels
No labels
bug
duplicate
enhancement/documentation
enhancement/feature
enhancement/organization
question
rejected
upstream
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
UserCurt/mpath#42
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Accessing an object array property produces a comma-separated list. MATLAB can assign one value to each object simultaneously:
MPath currently cannot perform the equivalent assignment:
Resolving
/Valueagainst an object array produces terminal comma-separated-list targets, whichsetrejects as unsupported.This issue proposes adding support for assignment to properties of object arrays.
Dynamic properties
Dynamic properties have a known limitation where accessing arrays of dynamic property objects behaves differently from scalar dynamic properties. Working around this limitation is outside the scope of this issue.
Mutation through non-terminal CSL selector outputs is now tracked separately in #45. This issue #42 remains focused on terminal CSL assignment.
There are a couple points are worth noting that complicate this issue.
First, terminal CSL assignments may not follow the order of the supplied pointers. Currently, MPath Performs
set(andremove) in the order in which they appear using linear index ordering. However, MATLAB may requires all outputs to be assigned together and in output order. For example, these pointer arrays select the same outputs:["/A/B<1>"; "/A/B<2>"; "/A/B<3>"]["/A/B<2>"; "/A/B<3>"; "/A/B<1>"]An unrelated target could also appear between members of the same output group:
["/A/B<1>"; "/A/B<2>"; "/X/Y"; "/A/B<3>"]MPath would need to reorder the targets and assign their values in the order of
<1>,<2>,<3>order regardless of the order in which the user specified them, and defer intermediate values until after the final one.Second, all terminal CSL selectors will have to be present. If
listLengthreports three outputs, then:["/A/B<1>"; "/A/B<2>"; "/A/B<3>"]contains the complete output group and would be a valid assignment.["/A/B<1>"; "/A/B<3>"]and"/A/B<1>"contain only part of the group and would have to be be rejected.To work around this, MPath could retrieve the omitted outputs and assign their existing values back to them, though that risks unintended side effects.
Completed by commit
1fc1091. It schedules eachUniformPathsgroup, validates all of them, and then performs the assignments. The scheduler requires all selectors<1>through<N>to be present and occur equal in number for the same prefix, with each one being a round of assignments.Assignment order is largely the same with linear indexing order, but with terminal selector rounds assigned as a group at the position of its earliest member, even if some members appear later or out of order.
Assignment of partial/uneven selector groups is intentionally not supported. That would require ignoring some assignments the user provided or introducing assignments the user omitted, either of which is not ideal.
Mutation through non-terminal comma-separated-list outputs remains tracked by #45.