Created
October 23, 2015 03:01
-
-
Save dahu/8324d9a46d3c91592c66 to your computer and use it in GitHub Desktop.
Messing with interfaces in VimL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Messing with interfaces | |
" Barry Arthur, Oct 2015 | |
function! Foo() | |
let obj = {} | |
func obj.register(a, b) | |
echo string(a:a) . ' and ' . string(a:b) | |
endfunc | |
return obj | |
endfunction | |
let x = Foo() | |
function! Bar(x) | |
let obj = {} | |
let obj.z = a:x | |
func obj.doit(a, b) | |
call call(self.z.register, [a:a, a:b], self) | |
endfunc | |
return obj | |
endfunction | |
let y = Bar(x) | |
call y.doit({'i' : 1}, {'j' : 2}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment