Nim icon indicating copy to clipboard operation
Nim copied to clipboard

fixes #25235; `skipParentCfg` in nim.cfg

Open Graveflo opened this issue 1 month ago • 1 comments

fixes #25235 in commands.nim and options.nim

  • adds a new config option skipParentDetectionMode that determines if we are checking for skipParentCfg
  • checks if we are in skipParentDetectionMode in processSwitch to ignore all cfg entries except skipParentCfg

in loadConfigs:

  • iterates the parentDir to root instead of from root to find the first instance of skipParentCfg
  • sets skipParentDetectionMode and disables side effects in parseDirective while in this mode
  • creates temp seq of paths that contain a cfg file to process later
  • cuts the process short if skipParentCfg is found, so we are left with a list of cfgs to process
  • iterates the tmp seq in reverse to get the "from root" behavior and only processing cleared paths

Graveflo avatar Nov 22 '25 20:11 Graveflo

Also, as a side note, Nim 3 is posturing to have 4 different config files with separate features on top of supporting these two legacy ones so apparently we are moving in this direction.

I'm more than happy to remove/change Nim 3's config system in favor of something better. There have been fruitful discussions about how the compiler should have a notion of a "package" and how a configuration should be package-wide.

We can also deprecate .nims files and add more features to the .cfg mechanism so that it reaches feature-parity in practice with NimScript. IMO Nimble should have taken Atlas's route and patch a nim.cfg file, not a Nimscript file, but that's rather easy to change. The .cfg mechanism is not so bad it needs replacement, only refinement. The NimScript mechanism however has proven to be the source of immense internal complexity.

Araq avatar Nov 27 '25 07:11 Araq