Unpredictable function return types seems to default to item()? instead of item()*. Applies to 9.4.2
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... ------------------------------------------------------- >>> 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
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@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
Hi Christian, Works! Thank you! Holen Sie sich Outlook für iOS<https://aka.ms/o0ukef> ________________________________ Von: Christian Grün <christian.gruen@gmail.com> Gesendet: Tuesday, August 25, 2020 9:26:26 AM An: Wiemer, Sebastian <Sebastian.Wiemer@adesso.de> Cc: basex-talk@mailman.uni-konstanz.de <basex-talk@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@adesso.de<mailto:Sebastian.Wiemer@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
participants (2)
-
Christian Grün -
Wiemer, Sebastian