Bugs item #1905940, was opened at 2008-03-03 00:10
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1905940&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: PF/compiler
Group: Pathfinder 0.22
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Ying Zhang (yingying)
Assigned to: Nobody/Anonymous (nobody)
Summary: PF: order of declared functions matters?

Initial Comment:
I declared two functions in a module with the same name, but one has 2 
parameters and the other one has 7 parameters.  When compiling my query, pf is 
not able to find the function signature with 7 parameters:

$ pf /tmp/tst.xq 
error in function application: wrong number of arguments for function 
`f:comparenodes' (expected 2, got 7)
# halted in /ufs/zhang/monet/dev/pathfinder/compiler/core/core.c 
(PFcore_apply), line 1345

The query and the module are the following:

$ cat /tmp/tst.xq 
import module namespace tst = "foo" at "/tmp/foo.xq";

for $i in ("localhost", "andorea")
let $d := doc("proj1.xml"),
    $u := $d//i,
    $r := $d//k,
    $used := $u,
    $returned := $r,
    $referred := ($u, $r),
    $upath := ("./title", "./year"),
    $rpath := ("./address", "./publisher")
return
tst:comparenodes( $used, $returned, $referred, $upath, $rpath, $u, $r)

$ cat /tmp/foo.xq 
module namespace f = "foo";

declare function f:comparenodes(
        $used as node()*, $returned as node()*, $referred as node()*,
        $upath as xs:string*, $rpath as xs:string*,
        $u as node()*, $r as node()* ) as node()*
{ f:comparenodes($u, $r) };

declare function f:comparenodes($u as node()*, $r as node()*) as node()*
{
    for $i in $u, $j in $r
    where $i is $j
    return $j
};



However, if I switch the order these two functions are declared, the same query 
/tmp/tst.xq can be compiled:

$ cat /tmp/foo.xq 
module namespace f = "foo";

declare function f:comparenodes($u as node()*, $r as node()*) as node()*
{
    for $i in $u, $j in $r
    where $i is $j
    return $j
};

declare function f:comparenodes(
        $used as node()*, $returned as node()*, $referred as node()*,
        $upath as xs:string*, $rpath as xs:string*,
        $u as node()*, $r as node()* ) as node()*
{ f:comparenodes($u, $r) };

$ pf /tmp/tst.xq 
....  # generated mil code


Jennie

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1905940&group_id=56967

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to