On 10/23/06, Philip Ganchev <[EMAIL PROTECTED]> wrote:
> On 10/23/06, Axel Liljencrantz <[EMAIL PROTECTED]> wrote:
> > On 10/23/06, Philip Ganchev <[EMAIL PROTECTED]> wrote:
> > > Since a few versions ago, I have been getting an error message when I
> > > start Fish:
> > >
> > > fish: Could not autoload item "functions", it is already being
> > > autoloaded. This is a circular dependency in the autoloading scripts,
> > > please remove it.
> > >
> > > Apparently it's because my file
> > > "~/.config/fish/functions/functions.fish" invokes ``functions foo -d
> > > "Bar"''.
> > >
> >
> > This is not a bug. Fish interprets this as an attempt to invoke the
> > 'functions' function while defining it. If you want to use the builtin
> > with the same name, you can write 'builtin functions foo -d'
>
> :-)  I see it as a bug from the user's point of view because I wasn't
> trying to define a function.  To do that, I would have to write
> ``function foo;'' and so on. :-)

It's not that you're trying to define a function thats the problem
it's that you can't _use_ a function until it's been defined. And fish
considers the function defined once the file in which the function is
defined has been completely sourced and parsed.

>
> Why should fish assume that any script necessarily defines a function
> (called the same name as the file)?  This is an extra rule to remember
> when writing a script, and leads to surprises like that, right?  Using
> ``builtin functions'' works, but why make people use it?

All scripts in the fish_function_path must be function definitions. To
me, that's a reasonable way to provide autoloading of functions. The
Matlab way of doing things means that when you call a new function
'foo', Matlab needs to open all files named 'foo.m' and check if they
contain functions. It is more work, uses more memory and it means
Matlab needs to open and parse every .m file in the path before
providing a list of all existing functions.

>
> It is a different thing to say that any function must be defined in a
> file with the right name, as Matlab does.
>

Yes, that is indeed different. But I like the structure of having
special directories for defining extra functions.

A resonable way to make things clearer would be to make sure that the
'function' builtin is the _only_ allowed command in function-autoload
files.

-- 
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to