Support dot traversal of containers.Map properties #43

Open
opened 2026-07-22 00:50:15 +00:00 by UserCurt · 0 comments
UserCurt commented 2026-07-22 00:50:15 +00:00 (Migrated from codeberg.org)

containers.Map exposes Count, KeyType, and ValueType as public properties. MATLAB can access them directly, and properties(map) lists them, but MPath currently treats them as missing.

data = containers.Map({'A', 'B'}, {1, 2});

data.Count
% 2

properties(data)
% Count
% KeyType
% ValueType

mpath.resolve(data, "/Count", MissingPolicy="missing")
% Current: <missing>
% Expected: /Count

mpath.get(data, "/Count")
% Current: 0x1 missing array
% Expected: 2

mpath.exists(data, "/Count")
% Current: false
% Expected: true

mpath.resolve(data, "/C*")
% Current: 0x1 empty mpath array
% Expected: /Count

Child discovery successfully finds these property names, the issue seems further downstream. listLength reports 1, while executing the indexing operation fails to retrieve the value, despite how it is possible with data.Count or subsref(data, substruct('.', 'Count')).

Note that dictionary behaves differently because keys, values, and numEntries are parameterless methods, not properties. Function and method invocation is outside the scope of MPath, at least for a long while.

Entries of the Map (and dictionary) are out of scope. They will be accessible once parenthesis indexing is available as their values are accessible through parenthesis operations such as map('A') rather than dot access.

`containers.Map` exposes `Count`, `KeyType`, and `ValueType` as public properties. MATLAB can access them directly, and `properties(map)` lists them, but MPath currently treats them as missing. ```matlab data = containers.Map({'A', 'B'}, {1, 2}); data.Count % 2 properties(data) % Count % KeyType % ValueType mpath.resolve(data, "/Count", MissingPolicy="missing") % Current: <missing> % Expected: /Count mpath.get(data, "/Count") % Current: 0x1 missing array % Expected: 2 mpath.exists(data, "/Count") % Current: false % Expected: true mpath.resolve(data, "/C*") % Current: 0x1 empty mpath array % Expected: /Count ``` Child discovery successfully finds these property names, the issue seems further downstream. `listLength` reports 1, while executing the indexing operation fails to retrieve the value, despite how it is possible with `data.Count` or `subsref(data, substruct('.', 'Count'))`. Note that `dictionary` behaves differently because `keys`, `values`, and `numEntries` are parameterless methods, not properties. Function and method invocation is outside the scope of MPath, at least for a long while. Entries of the Map (and dictionary) are out of scope. They will be accessible once parenthesis indexing is available as their values are accessible through parenthesis operations such as `map('A')` rather than dot access.
Sign in to join this conversation.
No description provided.