On Sun, May 19, 2024 at 7:01 AM Matheus Afonso Martins Moreira
<math...@matheusmoreira.com> wrote:
>
> > The issue is that what you want, and what I want,
> > and what konsolebox wants (and everyone else)
> > are all slightly different.
>
> The option solution which I proposed is not really in opposition
> to anything that anyone else wants. It will not break anything,
> it supports the same inputs and use cases as before, including
> the absolute path case you cited.

Just in case people might misinterpret it, I'll make it clear that I'm
not opposed to adding the `source -i` feature in builtin form.

I just don't like the way it's proposed to be implemented here.  I
described how `source -i` should work using a script with some
explanations but it's only a prototype.

I could implement it in C if it definitely gets accepted or before it
does if I get the urge to.

> On the other hand, the variable solution which everyone else
> seems to favor _does_ get in the way of what I want to do.

Are you referring to BASH_SOUCE_PATH being a source-only extension to PATH?

Yes it allows the location of library scripts to be specified
separately but it's not really useful.

You also would prefer `source` to not touch anything in PATH if it's
meant to look for libraries.  Mixing it up is just programmatically
unsound no matter how rare binaries in PATH might cause issues.
Encapsulation of the feature is the right way to do it.

> I don't really understand why there seems to be so much
> opposition to this. Ability to do something in pure bash is
> not an argument against this feature, especially since it
> overcomes limitations present in the pure bash solutions.
> Those are _real_ limitations, not some "personal hangups"
> as others called it. The pure bash solutions simply _cannot_
> both of these things, they must sacrifice one of them.

Indeed.  I hate that I have to rely on an external binary just to load
a script relative to the executable.  Example:

source "$(realpath -m "${BASH_SOURCE}/../../lib/script.bash")" || exit

If the `source -i` feature won't load a script using the calling
script as reference it's pointless and I'd rather see it not
implemented.

BASH_SOUCE_PATH on its own also adds little value.


-- 
konsolebox

Reply via email to