Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

remove set x[1] x[2] a b syntax #4236

Copy link
Copy link

Description

@krader1961
Issue body actions

This issue is to discuss removing a feature of the set command. Why? Because implementing support for tied variables (issue #4082) involves touching builtin_set(). Which is currently really hard to understand. So I wanted to refactor the src/builtin_set.cpp code into smaller components and eliminate all, or at least most, of the current lint warnings before doing the work for tied vars.

This caused me to notice a feature of the set command I was not aware of. From the man page:

If the variable name is one or more array elements, such as PATH[1 3 7], only those array elements specified will be changed. When array indices are specified to set, multiple arguments may be used to specify additional indexes, e.g. set PATH[1] PATH[4] /bin /sbin.

We don't have a single unit test for that second, alternative, syntax. Nor is there a single use in the fish project. Nor is there a single use in the Fisherman or Oh-My-Fish scripts.

This feature greatly complicates the code. It is also ambiguous and likely to be the source of errors if people actually used it. It also doesn't provide any functionality we don't already support via set PATH[1 4] /bin /sbin.

Run these two commands and examine the result: set x a b c d then set x[1 2] x[4] a. Now do set x[1 2] x[4] 1 2 3 and examine the result.

All in all I think fish 3.0 is the perfect time to remove support for this syntax.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

docsAn issue/PR that touches or should touch the docsAn issue/PR that touches or should touch the docsenhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.