…thanks. I already guessed it wasn’t that easy ;) I’ve added it to [1].
In general, I hope we could get completely rid of self-dependency checks. It was only defined for variables, not for functions, and I cannot see why we still need it today. We are currently discussing this topic for version 4.0 [2]. Best, Christian [1] https://github.com/BaseXdb/basex/issues/2324 [2] https://github.com/qt4cg/qtspecs/issues/1379 On Wed, Aug 14, 2024 at 1:02 PM Amanda Galtman <galtm...@proton.me> wrote: > Christian, thanks very much. > > I returned to my actual code, and it works with the latest snapshot dated > today. > > By the way, I also retried the variations I had created when trying to > explore workarounds, and one of them still doesn't work with the latest > snapshot. It's not blocking me, but in case it is helpful, I reduced it to > another small query that reproduces the error with today's snapshot. I know > you said you fixed part of the problem, so you might not be surprised that > the following code still triggers the error. > > xquery version "3.1"; > > declare variable $variant := > if (exists(function-lookup(QName('nonexistent','nonexistent'), 0))) > then > ( (: not relevant :) ) > else > function-lookup(QName('http://www.w3.org/2005/xpath-functions','string'), > 1); > > declare variable $variant-fcns := $variant; > > declare function local:fcn() { > $variant-fcns('abc') > }; > > local:fcn() > > > The levels of indirection (variable, variable, function, function call) > seem to be relevant for the problem. If I make the code more direct, it > works. > > Regards, > Amanda > > On Monday, August 12th, 2024 at 5:16 AM, Christian Grün < > christian.gr...@gmail.com> wrote: > > I managed to fix a part of the dependency problem. Your query should now > be executable with the latest snapshot [1]. > – Christian > > [1] https://files.basex.org/releases/latest/ > > > > On Fri, Aug 9, 2024 at 5:51 PM Amanda Galtman <galtm...@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 >> > >