Determenistic order of load plugins.
Now I have few plugins which extend menu. And menu items can change order from run to run zbs. Does ZBS order plugins by file name?
No, it loads them in the same order as returned by "pairs", which is not deterministic. I thought about sorting plugins before loading, but I'd not want plugins to depend on the order, as it may have strange effects and unintended consequences. Is there any reason other than the order of the items on the menu being different between runs?
@moteus, any further details on this? I'm tempted to close it, but would like to have more information behind the request before I do.
Sorry I thoght that i unswer on this. Yes I whant only determenistic menu order created by plugins. I think it is quite important
@moteus, I got that; I was looking for more details on why you think it's needed.
Is there any reason other than the order of the items on the menu being different between runs?
I was looking for more details on why you think it's needed.
I add menu items to popup menu and I use these items quite often. So when I need invoke one of menu I make right mouse click and whant to be able choose say last menu item or second from end whithout reading menu text. And in fact order is not not as importan. But just whant this order keeps same. Until I add new plugin with new menu item.
I looked at it again and recalled why I thought it was problematic. Deterministic order requires sorting and caching the results to order the keys, but it's not clear when to invalidate the cache results and it's likely to be wasteful to resort every time a hook is called. It can probably be done after onRegister and onUnregister events, but even that is not a full guarantee.