Lifepillar
unread,May 21, 2020, 12:05:28 PM5/21/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vim...@googlegroups.com
I have always believed that, in get(X,y,z), z would be evaluated only
when dictionary X does not contain key y. Today, to my surprise, I have
discovered that it is not the case:
fun! Loop()
call Loop()
endf
let H = { 'a': 1 }
if has_key(H, 'a') || Loop() " Fine, this is evaluated lazily
endif
echo (get(H, 'a') != 0) ? "" : Loop() " Fine, lazy
" But, endless recursion here:
echo get(H, 'a', Loop())
What is the rationale for this behaviour?
Thanks,
Life.