On 10/27/06, Beni Cherniavsky <[EMAIL PROTECTED]> wrote:
> On 25/10/06, Axel Liljencrantz <[EMAIL PROTECTED]> wrote:
> >
> > Ok, after a bit of digging, it seems that the problem is that because
> > the 'interactive.fish' file you sourced on startup is in a directory
> > in the $fish_function_path, fish gets a bit confused and may consider
> > the function to be autoloaded, even though you manually sourced it.
> > This behaviour is a bit confusing, I'll admit, but I think that the
> > behaviour when sourcing an autoloaded file shoiuld be left undefined,
> > since I fear that it's really hard to get any kind of well defined
> > behaviour with no painful corner cases.
> >
> Hard to implement or hard to define?

One or the other. :-)

One could easily define a behaviour but implementing it would be hard
and error prone. One could implement something that works in a sane
way, but describing all corner cases would be hard and error prone.

> I think it's obvious that
> autoloading is just a mechnism for loading undefined functions and it
> should never be tried if the name is already defined.

That is usually what happens. The issue was that a function named
'fish_interactive' was defined in a file named 'interactive.fish'
which was also in the autoload path. When the file was auoloaded, it
was done on the assumption that it would contain a function named
'interactive', not 'fish_interactive'. Had the file been named
fish_interactive.fish, fish would have noticed that there was already
a manually defined function with that name and not loaded the file.

The assumption of correspondance between function name and file name
is always made by fish, without it, fish would either need som form of
function cache, or go searching through every function definition file
at short intervals, neither of which seems desirable. One would add a
useless layer of complexity, the other would kill performance.

One way to avoid some of these issues would be to make it so that a
function autoloading file may only contain function definitions and
nothing else. Currently, a few functions do not follow this rules, for
example the definition of pwd and open is different on OS X. Moving
all such tests to inside of each function is possible, and it may be
the right way ahead. A slightly less restrictive rule, like
disallowing function definitions of functions with any other name than
the one suggested by the filename may also be a possiblity.

Neither of those solutions would make the problem go away completely,
but both would make some of the more confusing corner cases go away.

>
> --
> Beni Cherniavsky <[EMAIL PROTECTED]> (I read email only on weekends)
>


-- 
Axel

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to