Bugs item #1905940, was opened at 2008-03-03 00:10
Message generated for change (Comment added) made by sjoerd
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: Jan Rittinger (tsheyar)
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

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

>Comment By: Sjoerd Mullender (sjoerd)
Date: 2008-04-22 13:26

Message:
Logged In: YES 
user_id=43607
Originator: NO

Jan, can you comment on this?

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

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 the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to