Potential performance improvements of the parser: delay type widening in `parse_list_expression` and `parse_table_expression`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 40.5k
- Forks
- 2.3k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 79
Description
Basics
- I have done a basic search through the issue tracker to find similar or related issues.
- I have made myself familiar with the available features of Nushell for the particular area this enhancement request touches.
Related problem
let foo: list<any> = [1 2 3 a b c] currently triggers type widening when parsing the list expression, then the widened list<oneof<int, string>> is abandoned because there's an explicit type annotation list<any> in the assignment.
I would say most of the widened types are useless, and should only be computed when being checked against something non-trivial.
Describe the solution you'd like
https://github.com/nushell/nushell/pull/17575#issuecomment-4017986692
That strategy seems better suited for new-nu-parser.
Nu-parser probably needs more tweaks.
Describe alternatives you've considered
No response
Additional context and details
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with parse_list_expression and parse_table_expression in the Nu-parser and new-nu-parser implementations, then read the strategy discussed in PR #17575. Determine how explicit annotations such as list should avoid unnecessary type widening, and verify that the resulting parser behavior matches the intended deferred-checking strategy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, compilers
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100