1

I tried the fish shell some years ago but abandoned it for now forgotten reasons (there was something that I couldn't do with it).

I'm looking a fish again and trying to update my old scripts to work with the latest version and have run into an issue.

One of my old scripts defines a function with the --shadow-builtin option. That option no longer exists. What replaces its functionality?

1

1 Answer 1

3

The "--shadow-builtin" option was never released. You can just remove it.

It was supposed to be a marker you would add to a function if it had the same name as a builtin, and defining a function with the same name as a builtin without it would then be an error.

This was supposed to prevent issues if people define e.g. a "test" function, which would then break every use of the test builtin that isn't specifically prefixed like builtin test. But it turned out to cause its own set of problems and was reverted, along with the change that would forbid functions named like builtins, before it made it into a release.

You can see that the commit that introduced --shadow-builtin and the commit that removed it again both appear first in fish 2.4b1 (as git tag --contains will tell you, or the github interface which shows it below the commit message).

It appears that at the time you followed fish's development instead of sticking to a release.

5
  • FWIW, with fish 3.3.1, trying to define a function called string returns: fish: function: The name 'string' is reserved, and cannot be used as a function name Commented Aug 1, 2024 at 15:45
  • A few builtins are now reserved words. This includes all builtins that can modify variables (which includes string, because it can set variables from a regex) and a few very important ones like test. Commented Aug 1, 2024 at 15:50
  • It doesn't matter in this case, but I would prefer if you tested with a fish that was less than 16% of all commits ever made to fish behind if you want to talk about the current state. There are 2721 commits between 3.3.1 and the current 3.7.1. Commented Aug 1, 2024 at 15:51
  • That's the fish that comes with the system I currently use. I didn't mean to imply it was the latest fish. Sorry for the confusion. Commented Aug 1, 2024 at 15:55
  • Thanks for the clarification. Commented Aug 2, 2024 at 15:29

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.