BaseXdb / basex

BaseX Main Repository.
http://basex.org
BSD 3-Clause "New" or "Revised" License
679 stars 267 forks source link

Recursive function calls: Stack Overflow, XQDY0054 #2324

Open ChristianGruen opened 1 month ago

ChristianGruen commented 1 month ago

Based on #1095: The following queries still result in StackOverflow errors:

declare variable $f := map {
  'A': function($r, $f) { $r/x ! $f?B(., $f) },
  'B': function($r, $f) { $r/x ! $f?A(., $f) }
};
$f?A(<a/>, $f)
let $even := fn($n, $self, $odd) {
  $n = 0 and $odd($n - 1, $odd, $self)
}
let $odd := fn($n, $self, $even) {
  $n != 0 or $even($n - 1, $even, $self)  
}
return $even(1, $even, $odd)
ChristianGruen commented 4 weeks ago

And another one that raises XQDY0054 (see https://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/msg15865.html):

declare variable $a := function-lookup(xs:QName('local:x'), 0);
declare variable $b := $a;
declare function local:f() { $b };
local:f()