Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/pub_iter_imp into lp:zorba

2014-01-14 Thread Paul J. Lucas
It depends on what the semantics of fn:count() are, i.e., is is supposed to do 
the type checks that TreatIterator::nextImpl() does?  If the point of the count 
optimization is not to materialize the objects, then you (obviously) can't do 
type checks.  But is that legal?

However, I think (correct me if I'm wrong) that the presence of fn:count() 
wrapped around an expression changes what the expected type is (to xs:integer) 
and it also makes the quantization checks irrelevant since fn:count() works on 
any length sequence.

If that's true, then TreatIterator::count() would simply call its child's count 
without any other checks.  I think the same would be true for skip().
-- 
https://code.launchpad.net/~zorba-coders/zorba/pub_iter_imp/+merge/201708
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/pub_iter_imp into lp:zorba

2014-01-14 Thread Matthias Brantner
The problem is that there is a TreatIterator put in place checking the return 
type of the function.


  

  

  
  

  
  

  


The TreatIterator doesn't override count and, hence, the count call never gets 
executed on the ExtFunctionCallIterator. Could you please look at the 
implementation of the TreatIterator. I don't think this can easily be done but 
maybe you have an idea.
-- 
https://code.launchpad.net/~zorba-coders/zorba/pub_iter_imp/+merge/201708
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/pub_iter_imp into lp:zorba

2014-01-14 Thread Paul J. Lucas
So this looks right to me, but it doesn't work.  
ExtFunctionCallIterator::count() never gets called it seems.  I did a test like:

let $conn := ftp:connect( "127.0.0.1", $options )
let $remote-path := "/"
return fn:count( ftp:list( $conn, $remote-path ) )

That should work, right?
-- 
https://code.launchpad.net/~zorba-coders/zorba/pub_iter_imp/+merge/201708
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/pub_iter_imp into lp:zorba

2014-01-14 Thread Paul J. Lucas
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/pub_iter_imp/+merge/201708
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/pub_iter_imp into lp:zorba

2014-01-14 Thread Paul J. Lucas
Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/pub_iter_imp into 
lp:zorba.

Commit message:
Added count() & skip() to public Iterator API.

Requested reviews:
  Paul J. Lucas (paul-lucas)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/pub_iter_imp/+merge/201708

Added count() & skip() to public Iterator API.
-- 
https://code.launchpad.net/~zorba-coders/zorba/pub_iter_imp/+merge/201708
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'NOTICE.txt'
--- NOTICE.txt	2014-01-10 02:36:58 +
+++ NOTICE.txt	2014-01-15 03:04:02 +
@@ -482,7 +482,8 @@
 Copyright: 2000 D. J. Bernstein
 Website: http://cr.yp.to/ftpparse.html
 
-  Commercial use is fine, if you let me know what programs you're using this in.
+  Commercial use is fine, if you let me know what programs you're
+  using this in.
 
 
 External libraries used by this project:

=== modified file 'include/zorba/function.h'
--- include/zorba/function.h	2013-08-23 11:15:04 +
+++ include/zorba/function.h	2014-01-15 03:04:02 +
@@ -4,7 +4,7 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
@@ -30,10 +30,10 @@
 
 /**//**
   The Function class represents a function that is callable from XQuery code,
-  and it gives access to the various properties that are specified in the 
+  and it gives access to the various properties that are specified in the
   declaration of the function within a Prolog.
 
-  Instances of Function are returned by the StaticContext::findFunctions() 
+  Instances of Function are returned by the StaticContext::findFunctions()
   method. To be mopre precise, StaticContext::findFunctions() returns smart
   pointers to Function objects. These smart pointers must be destroyed before
   the StaticContext object they were obtained from is destroyed.
@@ -45,31 +45,27 @@
 class ZORBA_DLL_PUBLIC Function : public SmartObject
 {
  public:
-  /** \brief Destructor
-   */
-  virtual ~Function() {}
-
   /**
* @return True if the function is sequential; false otherwise.
-   */  
+   */
   virtual bool
   isSequential() const = 0;
 
   /**
* @return True if the function is updating; false otherwise.
-   */  
+   */
   virtual bool
   isUpdating() const = 0;
 
   /**
* @return True if the function is private; false otherwise.
-   */  
+   */
   virtual bool
   isPrivate() const = 0;
 
   /**
* @return True if the function is deterministic; false otherwise.
-   */  
+   */
   virtual bool
   isDeterministic() const = 0;
 
@@ -99,7 +95,7 @@
 
   /**
* @return The arity of the function. If the function is variadic (which is
-   * possible only for builtin functions), the result of this method 
+   * possible only for builtin functions), the result of this method
* is non-deterministic.
*/
   virtual size_t
@@ -119,7 +115,7 @@
 
   /**
* @return True if the function implementation is written in XQuery (or
-   * equivalently, it is a non-external function with a Prolog 
+   * equivalently, it is a non-external function with a Prolog
* declaration); false otherwise
*/
   virtual bool
@@ -138,10 +134,10 @@
   The ExternalFunction class serves as the base of subclasses that represent
   the implementation/body of external functions.
 
-  Instances of ExternalFunction must provide an evaluate method that serves 
-  as the implementation of the function. During its evaluation, an external 
-  function may or may not need to access the static and/or dynamic context of 
-  the invoking XQuery module. If the function implementation does need to 
+  Instances of ExternalFunction must provide an evaluate method that serves
+  as the implementation of the function. During its evaluation, an external
+  function may or may not need to access the static and/or dynamic context of
+  the invoking XQuery module. If the function implementation does need to
   access either context, the function is referred to as "contextual"; otherwise,
   it is "non-contextual".
 ***/
@@ -150,8 +146,7 @@
 public:
   typedef std::vector Arguments_t;
 
- public:
-  virtual ~ExternalFunction() {}
+  virtual ~ExternalFunction();
 
   /**
* @return The namespace URI of the function QName
@@ -189,8 +184,6 @@
 class ZORBA_DLL_PUBLIC NonContextualExternalFunction : public ExternalFunction
 {
  public:
-  virtual ~NonContextualExternalFunction() {}
-
   virtual ItemSequence_t
   evaluate(const Arguments_t&) const = 0;
 
@@ -201,7 +194,7 @@
 
 /**//**