Hi.

I propose 'ordered-dict' feature; dictionary remembers the order that its items 
are added.

spec:

The results of following functions are derived from the order that items are 
added into dict.

* items(dict), keys(dict), values(dict)
* copy(dict), extend(dict1, dict2)
* "echo dict", string(dict)

# EXCEPT: "g:", "s:", and other embedded dicts. their behaviors are same until 
now.

benefit:

* It guarantees the order of dict-items.
* The processing times of above functions are speeded up slightly
  by removing wasted dereference of items.
* It is also able to be used as 'ordered-set'.
  e.g. it might make the implementation of 'runtimepath' more efficient.

disadvantage:

* The sizes of structure dict_T and dictitem_T increase by the size of 2 
pointers.
* The processing times of dict_add() and dictitem_remove() increase a little.

patch:
https://gist.github.com/ichizok/a23a24158dcce3ecab58

The results of some existing tests are changed:
https://gist.github.com/ichizok/dfacb32910b63a9e32ab

Thank you.
- Ozaki Kiichi

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui