← Back to team overview

zorba-coders team mailing list archive

[Bug 962216] Re: stack & queue module

 

Review from Dana:

1. There is no distinction between a "stack" and any other collection. Do we need the distinction ? 
I guess so, because available-stacks gives all available-collections, which is wrong.
Plus, though the stack module one can delete ANY collection, which also seems wrong.

2. delete() should use the new trim() function on collections from the
trunk

3. Delete() should raise an error if the stack doesn't exist, not
silently do nothing

4. Documentation does not say that a COPY of the node is inserted in the stack/queue, and NOT
the original node. (copy is made at insertion time, like in a normal collection). 

Same comment for the copy() function.

5. create() should raise an error in case the thing already exists, not silently delete it and recreate a
new one.

6. Please re-write THAT into something efficient and decent:
 
declare function stack:available-stacks() as xs:QName* {
  for $collQName in collections-ddl:available-collections() return $collQName
};

(hint: collections-ddl:available-collections() would do)


7. Please rewrite THAT into something efficient and decent:
 
declare function stack:top($name as  xs:QName) as node()? {
  let $stackContent := collections-dml:collection($name)
  return   if(fn:not(fn:empty($stackContent))) then $stackContent[1]  else  ()
};

( hint: collections-dml:collection($name)[1]
 would do )


8. The empty() function should raise an error if the stack/queue doesn't exist. Exist and Empty are
different things.


** Changed in: zorba
       Status: New => In Progress

-- 
You received this bug notification because you are a member of Zorba
Coders, which is the registrant for Zorba.
https://bugs.launchpad.net/bugs/962216

Title:
  stack & queue module

Status in Zorba - The XQuery Processor:
  In Progress

Bug description:
  Implement two new modules:

  - stack for node items, using collections
  - queue for node items, using collections

To manage notifications about this bug go to:
https://bugs.launchpad.net/zorba/+bug/962216/+subscriptions


References