Himanshu Neema writes:
 > Thanks Kevin for your answers. If I understand it correctly, using
 > 'Dictionary' cannot be the source of non-determinism.

I would say that it is unlikely.  The hashing function is constant.

At some stage as you insert elements into the dictionary the
dictionary will have to increase the size of its hashtable which will
reorganize the keys (Dictionaries can also be compacted iflots of
entries are removed). It is *possible* that this is happening at
different times and so you are getting different orders but from a
quick look at the code I don't see how.

 > 
 > Kevin, I had to remove "import Dictionary" from
 > OrderedDictionary-Simple.oz, else it gave this runtime error:
 > 
 > %********************** Error: module manager *******************
 > %**
 > %** Could not link module
 > %**
 > %** Could not load functor at URL: ...omitted.../Dictionary.ozf
 > %**--------------------------------------------------------------
 > 

Whoops, if I left that in then that was a mistake.  As I said in my
previous message Don't ever import Dictionary, unless you are trying
to override the base dictionary with your own local functor.


 > And if I had "import Dictionary at 'x-oz://system/adt/Dictionary'"
 > instead, the runtime error was:
 > 
 > %***************** Error: illegal field selection ***************
 > %**
 > %** In statement: 'export'(new:<P/1 New> newFromRecord:<P/2
 > NewFromRecord>) . is = _<optimized>
 > %** In statement: {<P/3 Value.'.'> 'export'(new:<P/1 New>
 > newFromRecord:<P/2 NewFromRecord>) is _}
 > %**
 > %** Call Stack:
 > %** procedure 'Default' in file "./OrderedDictionary.oz", line 61,
 > column 3, PC = 11203084
 > %** procedure in file "./OrderedDictionary.oz", line 13, column 0, PC =
 > 11203224
 > %** procedure 'RootManager,Pickle/fast' in file
 > "d:/cygwin/home/bruni/Projects/Mozart/Sources/share
 > /lib/init/Module.oz", line 244, column 6, PC = 10976392
 > %** procedure in file
 > "/home/kost/compile/build-1.3.0/updates/mozart/share/lib/base/Base.oz",
 > line
 > 92, column 7, PC = 11035332
 > %**--------------------------------------------------------------
 > 

this is the ADT dictionary from the Standard Library. Documentation is
here:


   http://www.mozart-oz.org/documentation/mozart-stdlib/adt/dictionary.html  

 > Is this version safe when same OrderedDictionary is modified/accessed
 > from both parent and child spaces?
 > 
 > 


I suppose it is equal to a normal dictionary. I have never looked at
this.

cheers
k


  

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to