File searching



C Y ?????:
> --- Raymond Toy <toy@rtp.ericsson.se> wrote:
> 
>>I think this has come up before (in some other thread that I can't
>>remember), but I'd like to raise it again in it's own thread.
>>
>>Currently, the share directory has lots of subdirectories with files
>>therein.  If you want to load something, you actually need to know
>>the
>>subdirectory that it's in.  I find this rather annoying.  I'd like to
>>be able to say load("coolstuff") and have maxima look in the share
>>directory and load it up automatically.
>>
>>There is precedence for this behavior:  emacs does this, and CMUCL's
>>search-list extension allows you to do this.
>>
>>Probably not for the upcoming release, but something to think about
>>for the next release.  Opinions?
>>
>>Ray
> 
> 
> This did come up earlier.  Jim raised a concern about files with
> duplicate names in subdirectories of a search. I very much agree with
> Ray - have maxima find it.  Here's what I proposed as a possible way to
> handle that problem - I think it got lost in email limbo land (as usual
> I'm not sure how difficult what I'm proposing would be to impliment.)
> 
> The main arguement against specifying the directory (as far as I can
> tell, anyway) is the extra typing needed.  This sounds like a trivial
> concern, but it will signficantly impact the usability of the system in
> the eyes of users.  There is another way things can be worked:
> 
> Have the system scan the subdirectories, and in the case of two or more
> names which match, present the user with a list.  Something like this
> (simulated session):
> 
> Maxima 5.9.0pre-cvs (with enhancements by W. Schelter).
> Licensed under the GNU Public License (see file COPYING)
> (C1) load("diffeq.mac");
> Multiple matches found for filename "diffeq.mac"
> Select the package you want to use:
> 
> 1) diffequations/diffeq.mac
> 2) graphics/diffeq.mac
> 3) numer/diffeq.mac
> 
> 3
> (D1)  /usr/local/share/maxima/5.9.0pre-cvs/share/numeric/diffeq.mac
> (C2) 
> 
> Would that work?
> 
> CY
> 

I also prefer to have smarter load() function. Below is a quote
from my previous mail which by my mistake was not sent to
James but not to gcl-devel list:
----------------------------------------------------------------------
JA wrote:

> Another good question. I worried about that quite a bit, then decided
> that "smarter" was a bad idea. I think scanning all the subdirectories
> largely defeats the purpose of creating them in the first place. I'm
> particularly worried about the case where there are two files with the
> same name in different subdirectories.
>
> Feel free to try to convince me otherwise.


I'll try :-)

First of all in my understanding the only purpose of subdirectories
is to split large heap (or several "historical" heaps like share1, share2
etc) of packages into some sensible categories.
This is just matter of user's convenience.
But as soon as user find any interesting package in some
share subdir he will probably prefer shorter form load("pack")
to long one load("subdir/pack").

As for name conflicts at present we don't have any name clashes in
Maxima share.  And I think we should avoid this by all means
in the future.  Can you practically imagine two
or more packages with the same name in different subdirectories?
Yes, this is possible physically but it immediately creates lots
of confusion.  What are these packages?  Are they the same,
or different versions,  or completely unrelated?
I'm just trying to convince you that situation with conflicting
packages is quite unlikely and even more - we should not allow this.

But even if  we have two or more packages with the same name
then user can choose one either interactively (like Cliff suggested)
or by explicit load("subdir/pack").

-----------------------------------------------------------------------