-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Cell paths: foo.1 is not always equal to 1.foo #7498
Copy link
Copy link
Closed
Labels
A:type-systemProblems or features related to nushell's type systemProblems or features related to nushell's type systemsemanticsPlaces where we should define/clarify nushell's semanticsPlaces where we should define/clarify nushell's semantics
Milestone
Description
Describe the bug
How to reproduce
- Run
[ { foo: "bar"}, { } ] | get foo.1, it returnsNothing - Run
[ { foo: "bar"}, { } ] | get 1.foo, it fails with aShellError
Expected behavior
If a cell path has 2 members and one member is a number but the other is a column name, the order of those members should not matter. I'm not sure exactly what the behaviour should be here, but I do think it's desirable for the behaviour to be consistent.
I lean toward making both return a ShellError, but I'm not sure if there are some situations where that would be problematic (dealing with JSON files maybe?). Please chime in if you have an opinion or are aware of important scenarios we should be considering.
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.72.2 |
| branch | main |
| commit_hash | b7572f1 |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.65.0 (897e37553 2022-11-02) |
| rust_channel | 1.65.0-x86_64-unknown-linux-gnu |
| cargo_version | cargo 1.65.0 (4bc8f24d3 2022-10-20) |
| pkg_version | 0.72.2 |
| build_time | 2022-12-07 16:34:42 -08:00 |
| build_rust_channel | debug |
| features | database, default, trash, which, zip |
| installed_plugins |
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A:type-systemProblems or features related to nushell's type systemProblems or features related to nushell's type systemsemanticsPlaces where we should define/clarify nushell's semanticsPlaces where we should define/clarify nushell's semantics
