You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current Display implementation for CellPath directly outputs both the string key/column members and int row. This makes it impossible to distinguish columns from rows should they contain only numbers or contain a dot.
should this include a unique prefix as in $. to be equivalent to its literal?
Which quoting/escaping routine to use, on top of detection of . or all digits, this also has to take into account the used quotes or what escape sequences are active in those.
Seems like the original intent of the cell-path literal was to be able to construct cell-paths and then use them for select and maybe get. So, however we change it, we need to ensure that still works.
letcp= $."foo.bar".baz$table|select$cp
We also need to keep in mind that we have into cell-path as well so theoretically there may need to be changes there too.
Currently into cell-path only accepts either an index or a structured form as a list or table so it doesn't have the full parsing logic to deal with (so unquoting/unescaping) and can immediately generate unique/correct cell paths.
I think when showing such a cell path it should be pretty much equivalent to the corresponding literal.
Another thing to note is that the Display implementation for CellPath is used when serializing cell paths to nuon. Because of this escaping issue, $value | to nuon | from nuon may not return the same value.
should this include a unique prefix as in $. to be equivalent to its literal?
I'm leaning towards yes, but I thinking leaving the prefix out is also fine.
Activity
[-]Cell path output doesn't escape/quote properly[/-][+]Cell path display output doesn't escape/quote properly[/+]sholderbach commentedon Jul 12, 2024
Additional challenges:
$.to be equivalent to its literal?.or all digits, this also has to take into account the used quotes or what escape sequences are active in those.selectcurrently flattening deep nested acesses usingDisplay(see Fixselectcell path renaming behavior #13361)fdncred commentedon Jul 12, 2024
Seems like the original intent of the cell-path literal was to be able to construct cell-paths and then use them for
selectand maybeget. So, however we change it, we need to ensure that still works.We also need to keep in mind that we have
into cell-pathas well so theoretically there may need to be changes there too.sholderbach commentedon Jul 12, 2024
Currently
into cell-pathonly accepts either an index or a structured form as a list or table so it doesn't have the full parsing logic to deal with (so unquoting/unescaping) and can immediately generate unique/correct cell paths.I think when showing such a cell path it should be pretty much equivalent to the corresponding literal.
IanManske commentedon Jul 13, 2024
Another thing to note is that the
Displayimplementation forCellPathis used when serializing cell paths to nuon. Because of this escaping issue,$value | to nuon | from nuonmay not return the same value.I'm leaning towards yes, but I thinking leaving the prefix out is also fine.
Improve `CellPath` display output (nushell#14197)