Is it really intended that no auto-instantiation/creation is done for
list and dict elements when they are assigned to?  I.e. in the
following code,

                        let bufs_in_session = {}
                        for match in matches
                                let [ junk, session, bufname ] = matchlist( 
match,
'^\([^|]\+\)|[^|]\+|\s*edit\s*\(.*\)' )
                                call add( bufs_in_session[session], bufname )
                        endfor

I'm going to have to add

    if !exists('bufs_in_session[ session ]' )
        let bufs_in_session[ session ] = []
    endif

each time through the loop.  That every element must be explicitly defined with

let somedict[ key ] =

gets tedious.  It seems like Vim script has evolved to the point where
it should be just a little bit more dynamic.  I can't really think of
any cases where returning a "doesn't exist" error for assignment to a
list or dict element would be helpful.  It already knows from context
what type the element should be, since the error message will flag
type mismatches

P.S. Regular vars suffer from this also, with operations like += , etc.

Reply via email to