Thanks, Christian.

By the way, I found a workaround for my immediate need: putting all the function-lookup usage in module functions instead of a global variable.

Regards,
Amanda

On Monday, August 12th, 2024 at 4:43 AM, Christian Grün <christian.gruen@gmail.com> wrote:
Hi Amanda,

It is high time to tackle an existing GitHub issue that most likely relates to the same bug [1].

Thanks for your observation,
Christian



On Fri, Aug 9, 2024 at 5:51 PM Amanda Galtman <galtmana@proton.me> wrote:
Hi, all.

I'm seeing an error in BaseX when I use function-lookup in both a global variable and a function, where the function relies on the variable. I reduced the situation to the following small query:

xquery version "3.1";
declare variable $local:lookup := function-lookup(QName("nonexistent", "nonexistent"), 1);
declare function local:myfcn() {
let $f := ($local:lookup, function-lookup(QName('http://www.w3.org/2005/xpath-functions','string'), 1))[1]
return $f('a')
};
local:myfcn()

When I run it with BaseX 11.1, I get
[XQDY0054] Static variable depends on itself: $local:lookup

When I run it with Saxon-HE 12, I don't get this error.

Is there anything I can do in my code to avoid this error?

Thanks,
Amanda