On Fri, May 3, 2024 at 5:26 AM Koichi Murase <myoga.mur...@gmail.com> wrote:

>
>
> By the name "import", I expect also something like an include guard,
> i.e., it loads the same file only once at most. I have a
> shell-function implementation,`ble-import', in my framework. It
> doesn't support namespace, but it supports the include guard. It also
> accepts a setting for the paths to search. It also has a feature like
> `with-eval-after-load' of elisp (or the "onload" event).
>
> --
> Koichi
>
>
I don't think we need yet another builtin named 'import' for all the reason
mentioned in the mail thread.
Setting BASH_IMPORT_PATH in an .rc file is not less confusing than simply
setting PATH in the same .rc file. In the case one mix'n'match dir setup in
both PATH and BASH_IMPORT_PATH, and in case of mix'n'match -x more setting
of a .sh files, then all sort of documentation must be done to explicitly
tells which case takes precedence etc... I prefere by far to handle $PATH
myself in my .rc and place myself my 'shell packages' in my hierarchies.

Note that a package (an import) generally is non executable, as some
mentioned, yet beeing able to 'run' a package can be interesting in some
case, for instance a pacakge run can display its embedded documentation,
useful during development (yet debatable)

My package management have the same feature as @Koichi one, i.e a C like
#pragma once.

I add a 'force' option to my 'import', this is for interactive 'import', to
bring more functions (global, alias), yet during bring-up one may fix a
package an force a reload.

Some packages, on the other hand, are to be used 'imported' by other
packages and as such I have versioning mechanism, so 'import' can tell
about new version available from the git repos, or even an auto update from
git (when suitable) etc... and indeed it is possible for the import to tell
which minimal version is needed for the 'import'.

So doing an 'import' feature, may be to be on par with python/perl/nameit,
require more than just a new ENV var and the hack to use it.

Cheers

Reply via email to