On Mon, 23 Oct 2006 at 5:16pm, Yegappan Lakshmanan wrote: > Hi all, > > When a non-existing dictionary function is invoked using the ":call" > command, there is no error. But when it is used in an expression, > an error message is displayed. Is this the expected behavior? > > let a = {} > call a.xyz() > > The ":call" command silently returns without any errors. But > the following commands result in error: > > :let x = a.xyz() > E716: Key not present in Dictionary: xyz() > E15: Invalid expression: a.xyz() > > :echo a.xyz() > E716: Key not present in Dictionary: xyz() > E15: Invalid expression: a.xyz()
I think I saw the same behavior, though I didn't do the analysis on why certain calls don't generate an error (assumed that the Vim actually ignored the error because of <silent> mode or something like that). I actually want to propose that dictionary should call a special function (if available) before giving an error. That will allow us to extend the dictionary functionality to support some (psuedo) inheritance. The special function should be passed with the name of the function that user called and the arguments, and the return value of the special function should be passed back to the caller. -- Thanks, Hari __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com