I have a module that creates menu position rules automatically by calling menu_position_add_rule(). Unfortunately, I would like to weight these rules based on the specificity of the rule, and menu_position_add_rule() does not set weight even if the parameter is passed as part of $rule.

menu_position_add_rule() also does not return the value of the $rid that was added, so in order to set the weight for a new rule, I have to call menu_position_read_rules(), parse through all existing rules to find the rule that matches the conditions for the one I just created, and then call my own db_update on it to add weight.

It seems it would be much easier to just allow weight to be set initially.