Based on my experience with many other tools, this is what I would suggest/expect:
First, order matters. SetLibPath ~/lib/mma $_LibPath sets two search locations, in this order.
Well, almost. Remember that a path in SetLibPath can contain multiple library collections (directories). The default "/usr/share/mma/lib" for example has stdlib, kara, etc.
With the new code, using your example, the search will start off in ~/lib. And if you have more that one dir in there, and you want to force one of these dirs to be first checked you can do something like:
SetLibPath ~/lib/testing ~/lib/new ~/lib/great $_Libpath
When looking for a filename (e.g., USE mygroove.mma), look it up in the search locations. Do not use the .mmaDB and do not descend to subdirectories. It's an ordinary file search. If I'd want the stdlib subdirectory to be searched I can specify SetLibPath ~/lib/mma $_LibPath $_LibPath/stdlib .
The .mmaDB is not used for USE searches. The directories specified in LibPath are checked in their order. You can "print $_Libpath" to see the order. Also, you can add a dir to the USE: "Use mylib/funk" is fine.
Note that USE always loads in a groove file. this can be useful if you have changed things and want to start fresh in the middle of a song.
When looking for a groove (e.g., GROOVE MyGroove), first append .mma and try a filename lookup as described above, and if that fails, consult the indexes. All indexes. Again, in the order of the LibPath, but with subdirectories.
I think this is the current behavior. Mostly
This provides ample ways to control which file is actually used.
There are some ambiguities, e.g. assume there's a MyGroove defined in $_LibPath/stdlib/foo.mma and in $_LibPath/blah/foo.mma. But this is not different from the current situation.
Just a matter of using Groove stdlib:bigbandintro vrs blah:bigbandintro
Just a matter of knowing the filename, including the library, and the groovename.
Also, emphasise that the user should never change or add things in mma's libpath. When you install a packaged version of mma ordinary users won't have write access to the mma library anyway.
Good point.
Hope this helps.
Yes. I'm at a disadvantage
I keep my lib in my home directory with a link from /usr/lib/mma. So I never run into access problems.
Bonus points for an environment variable MMA_LIB that hold the initial value for $_LibPath.
Isn't this simpler to do in a mmarc file?
Thanks for the input!