Here is a patch that adds set() function on the lines of existing get()
for setting list elements by index or dict keys by name. The reason I
wanted this is the lack of support to use :let for modifying the
dictionary elements. E.g., the below will be an error:

:let get_dict().key = 'val'

The alternative is to use the new set() function as:

:call set(get_dict(), 'key', 'val')

The function also returns the new value. Notice that the :let syntax
works to call functions on the dict, so the below is valid:

:let x = get_dict().getX()

Together, I think they will serve most or all of the use cases.

This is my first patch for Vim, and I haven't touched c/c++ code in
years, so I don't know if I screwed up on something.

I can write the documentation if Bram OK's the patch. I don't know if
there are any tests that need to be emended, and if so where they are.

-- 
Thanks,
Hari

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Attachment: set_patch.diff
Description: 919171944-set_patch.diff

Reply via email to