Hari Krishna Dara wrote: > On Wed, 25 Oct 2006 at 9:16am, Nikolai Weibull wrote: > > > On 10/25/06, Hari Krishna Dara <[EMAIL PROTECTED]> wrote: > > > > > > 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') > > > > Wouldn't it be better to allow the :let syntax you describe above? It > > shouldn't be impossible to parse that kind of expression. > > - A set() function will be nice to have anyway (to balance out get()) > - Adding a function is much easier (at least for me as a newbie) and the > change is more isolated than changing the syntax of the :let command. > This also means better likely hood of getting incorporated sooner. > - The last time the :let syntax was discussed, I don't think Bram agreed > to fix this issue, which indicates he is not in favor of that, and > so less likelyhood to get incorporated. > > BTW, I noticed that I had the min args as 2 (copied from f_get) which is > wrong, it should be 3. I can send another patch, again if Bram is OK > with this change at all.
I would prefer the ":let" command to work. It's not easy to implement but would be good for consistency. The main reason get() exists is to be able to handle non-existing keys in a simple way. That argument doesn't hold for set(). The dictionary was modelled after Python, and I don't think that Python has set(). -- Corduroy pillows: They're making headlines! /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
