bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/4] Add import builtin


From: Phi Debian
Subject: Re: [PATCH 0/4] Add import builtin
Date: Mon, 6 May 2024 07:21:22 +0200

On Sun, May 5, 2024 at 9:47 PM Greg Wooledge <greg@wooledge.org> wrote:

> On Sun, May 05, 2024 at 03:32:04PM -0400, Lawrence Velázquez wrote:
>
>
> The idea to add a BASH_SOURCE_PATH variable that gets searched before, or
> instead of, PATH when using the source builtin -- that sounds good.  I
> don't really understand the concepts behind the rest of the discussion.
>
>
Well even this is unclear 'BASH_SOURCE_PATH get searched before PATH' or
'BASH_SOURCE_PATH get searched instead of' or even 'BASH_SOURCE_PATH get
searched after PATH'

Each have valid reasons to exist...

Anyway if this is the only desire then a simple

In module system init .sh (used by .rc or other .sh)
IPATH=... ; alias xyz_import ='PATH="$IPATH" source' ; alias xyz_type
='PATH="$IPATH" type'

Above the setup is for 'instead of PATH', 'PATH="$IPATH:$PATH" source' for
before PATH and so on.

Then you can use xyz_import foo.sh or xyz_type foo.sh

BTW I didn't red all the patches, but I wonder what the semantic of the
builtin 'type' becomes in your implementation, I guess that on top of
currently defined concepts (file, function, alias, builtin) you now add
'library (better name needed)' with all the docco and jazz about it.

The risk/profit (or even ROI) seems not favorable, i.e the implementation,
the QA tests, the docco.

For something that can be done in a 1 liner in an .rc file, I am really not
convinced.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]