Unpredictable function return types seems to default to item()? instead of item()*. Applies to 9.4.2

Monday, 24 August 2020 · 3 messages · last reply 27 Aug 2020
WS
Wiemer, Sebastian24 Aug 2020 16:28 #
Hi, Thank you Christian for the new 9.4.2. release! The function "f()" below will yield to the error: "Cannot promote item()? to xs:integer?: $result_4" This works in BaseX 9.1 ------
declare function local:f() as xs:integer()*{
    let $id := client:connect("localhost", 1984, "admin", "admin")
    let $result :=         client:query($id, "1,2")
    let $close :=         client:close($id)
    return $result
 };

local:f()
----- I guess, that unpredictable return types at compile time default to item()? instead of item()* and thus cannot be used in a function returning anything else but item()? Has someone an idea for a solution/workaround for this? Best regards, Sebastian Eine Studie. Über 1300 Befragte. Ein Thema: Künstliche Intelligenz. https://ki.adesso.de/de/erste-schritte/index.html?pk_campaign=KI%20Report&pk_source=Signatur&pk_medium=Banner
Quoted text · 2 lines
------------------------------------------------------- >>> business. people. technology. <<<
------------------------------------------------------- adesso SE mit Sitz in Dortmund Vorstand: Michael Kenfenheuer (Vors.), Dirk Pothen, Andreas Prenneis, Stefan Riedel, Jörg Schroeder Vorsitzender des Aufsichtsrates: Prof. Dr. Volker Gruhn Amtsgericht Dortmund HRB 20663
CG
Christian Grün25 Aug 2020 09:26 #
Hi Sebastian, The static type of the client:query function is fixed. A new snapshot is available [1]. Hope this helps, Christian [1] https://files.basex.org/releases/latest/
Quoted text · Sebastian · 46 lines
On Mon, Aug 24, 2020 at 4:29 PM Wiemer, Sebastian < Sebastian.Wiemer at adesso.de> wrote: > Hi, > > Thank you Christian for the new 9.4.2. release! > > > The function "f()" below will yield to the error: "Cannot promote item()? > to xs:integer?: $result_4" > This works in BaseX 9.1 > > ------ > > declare function local:f() as xs:integer()*{ > let $id := client:connect("localhost", 1984, "admin", "admin") > let $result := client:query($id, "1,2") > let $close := client:close($id) > return $result > }; > > local:f() > > ----- > > I guess, that unpredictable return types at compile time default to > item()? instead of item()* > and thus cannot be used in a function returning anything else but item()? > > Has someone an idea for a solution/workaround for this? > > Best regards, > Sebastian > > > > <https://ki.adesso.de/de/erste-schritte/index.html?pk_campaign=KI%20Report&pk_source=Signatur&pk_medium=Banner> > ------------------------------------------------------- > >>> business. people. technology. <<< > ------------------------------------------------------- > > adesso SE mit Sitz in Dortmund > Vorstand: Michael Kenfenheuer (Vors.), Dirk Pothen, Andreas Prenneis, > Stefan Riedel, Jörg Schroeder > Vorsitzender des Aufsichtsrates: Prof. Dr. Volker Gruhn > Amtsgericht Dortmund HRB 20663 >
WS
Wiemer, Sebastian27 Aug 2020 10:04 #
Hi Christian, Works! Thank you! Holen Sie sich Outlook für iOS<https://aka.ms/o0ukef>
Quoted text · Christian Grün · 38 lines
Von: Christian Grün <christian.gruen at gmail.com> Gesendet: Tuesday, August 25, 2020 9:26:26 AM An: Wiemer, Sebastian <Sebastian.Wiemer at adesso.de> Cc: basex-talk at mailman.uni-konstanz.de <basex-talk at mailman.uni-konstanz.de> Betreff: Re: [basex-talk] Unpredictable function return types seems to default to item()? instead of item()*. Applies to 9.4.2 Hi Sebastian, The static type of the client:query function is fixed. A new snapshot is available [1]. Hope this helps, Christian [1] https://files.basex.org/releases/latest/ On Mon, Aug 24, 2020 at 4:29 PM Wiemer, Sebastian <Sebastian.Wiemer at adesso.de<mailto:Sebastian.Wiemer at adesso.de>> wrote: Hi, Thank you Christian for the new 9.4.2. release! The function "f()" below will yield to the error: "Cannot promote item()? to xs:integer?: $result_4" This works in BaseX 9.1 ------ declare function local:f() as xs:integer()*{ let $id := client:connect("localhost", 1984, "admin", "admin") let $result := client:query($id, "1,2") let $close := client:close($id) return $result }; local:f() ----- I guess, that unpredictable return types at compile time default to item()? instead of item()* and thus cannot be used in a function returning anything else but item()? Has someone an idea for a solution/workaround for this? Best regards, Sebastian [https://www.adesso.de/adesso-de/downloads/e-mail-signatur-reports.jpg] <https://ki.adesso.de/de/erste-schritte/index.html?pk_campaign=KI%20Report&pk_source=Signatur&pk_medium=Banner> ------------------------------------------------------- >>> business. people. technology. <<< ------------------------------------------------------- adesso SE mit Sitz in Dortmund Vorstand: Michael Kenfenheuer (Vors.), Dirk Pothen, Andreas Prenneis, Stefan Riedel, Jörg Schroeder Vorsitzender des Aufsichtsrates: Prof. Dr. Volker Gruhn Amtsgericht Dortmund HRB 20663

⚡Generated with XQuery