{"id":275541,"date":"2016-03-04T23:03:02","date_gmt":"2016-03-04T20:03:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=275541"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=275541","title":{"rendered":"Humane VimScript: \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u0430\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u0430\u044f \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044f"},"content":{"rendered":"<p>       \u042f \u0441\u0447\u0438\u0442\u0430\u044e VimScript \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u043d\u044b\u043c, \u043d\u043e \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043c\u043e\u0449\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u0438\u0442\u044c, \u0447\u0435\u043c \u044f \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u0430\u043c \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u0442\u0430\u0442\u0435\u0439. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u043d\u0430 VimScript \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u044b, \u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043a\u0430\u0441\u0430\u0442\u044c\u0441\u044f \u043e\u0441\u043d\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u043c\u0441\u044f \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0441\u0442\u0430\u0432\u0448\u0438\u0445 \u043d\u0430\u043c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0439.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h1>\u041e\u0431\u044a\u0435\u043a\u0442\u043d\u0430\u044f-\u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u0435\u0435<\/h1>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0447\u0438\u0442\u0430\u043b\u0438 \u043c\u043e\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e VimScript \u0438 \u0438\u0437\u0443\u0447\u0430\u043b\u0438 \u043c\u043e\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/Bashka\/vim_lib\">vim_lib<\/a>, \u043d\u0435 \u043f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438 \u043e\u043d\u0430 \u0443\u0434\u043e\u0431\u043d\u0430 \u0438 \u043f\u0440\u043e\u0441\u0442\u0430 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438? <b>\u041d\u0435 \u043f\u0440\u0430\u0432\u0434\u0430<\/b>! \u041f\u043e\u0440\u043e\u0439 &quot;\u0437\u0430\u043f\u0430\u0445\u0438 \u043a\u043e\u0434\u0430&quot; \u0442\u0430\u043a \u0440\u0435\u0436\u0443\u0442 \u043c\u043d\u0435 \u0433\u043b\u0430\u0437\u0430, \u0447\u0442\u043e \u044f \u043d\u0435 \u043c\u043e\u0433\u0443 \u0435\u0433\u043e \u0447\u0438\u0442\u0430\u0442\u044c. \u0414\u0430\u0436\u0435 \u0441\u043b\u0430\u0431\u044b\u0439 &quot;\u0437\u0430\u043f\u0430\u0448\u043e\u043a&quot; \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435\u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0438\u043c\u043e\u0435 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c &quot;\u043b\u0443\u0447\u0448\u0435&quot;, &quot;\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435&quot;, &quot;\u043f\u0440\u043e\u0449\u0435&quot;. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e \u044d\u0442\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0441\u0435 \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0438 \u0443 \u043c\u0435\u043d\u044f \u044d\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c. \u0412 \u044d\u0442\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u0442\u0430\u0442\u0435\u0439 \u044f \u043b\u0438\u0448\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f (\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0443\u0433\u043e\u0434\u043d\u043e) \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0430 \u043d\u0435 \u0431\u0443\u0434\u0443 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443.<\/p>\n<p>  \u0417\u0430 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0433\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 Object \u0432 VimScript \u044f \u0443\u0431\u0435\u0434\u0438\u043b\u0441\u044f, \u0447\u0442\u043e \u043e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 &quot;\u043a\u043e\u0434 \u0434\u043b\u044f \u0433\u0430\u043b\u043e\u0447\u043a\u0438&quot;, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u0441\u044f. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f &quot;\u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0430\u0445&quot;, \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u043f\u043e\u0440\u0430 \u0432\u0441\u0435 \u0443\u043f\u0440\u043e\u0449\u0430\u0442\u044c. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u0442 \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 VimScript:<\/p>\n<ul>\n<li>\u041a\u043b\u0430\u0441\u0441\u044b \u2014 \u0438\u0445 \u043d\u0435\u0442 \u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0432\u044b\u0445. \u041a\u043b\u0430\u0441\u0441 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043d\u0430\u0431\u043e\u0440\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0438\u0445 \u044d\u0442\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430<\/li>\n<li>\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u2014 \u0447\u0435\u043c \u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u044c\u043d\u044b\u0439 \u0432\u0435\u043b\u043e\u0441\u0435\u043f\u0435\u0434, \u043f\u0440\u043e\u0449\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0442\u0441\u044f \u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. \u0420\u0430\u0437 \u044f\u0437\u044b\u043a \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044e \u043d\u0430 \u043f\u0440\u044f\u043c\u0443\u044e, \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043c\u0443\u0447\u0430\u0442\u044c \u0435\u0433\u043e<\/li>\n<li>\u0421\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u2014 \u044d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0432\u0435\u0449\u044c, \u043d\u043e \u043d\u0435 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438, \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0449\u0438\u043c\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043e\u0431\u044a\u0435\u043a\u0442. \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u043a\u0430, \u043b\u0443\u0447\u0448\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/li>\n<\/ul>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b \u0443\u0436\u0435 \u0437\u0430\u0434\u0430\u0435\u0442\u0435\u0441\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c: &quot;\u041a\u0430\u043a \u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0435\u0437 \u043a\u043b\u0430\u0441\u0441\u043e\u0432?&quot; \u2014 \u0432\u0441\u0435 \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043e\u0434\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0430\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043d\u0443\u0436\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439. \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 JavaScript, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438? \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u0433\u043e\u0442\u043e\u0432\u043e\u043c \u0432\u0438\u0434\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">let s:Parent = {} function! s:Parent.new(a) dict   return extend({'a': a:a}, s:Parent) endfunction  function! s:Parent.setA(a) dict   let l:self.a = a:a endfunction  function! s:Parent.getA() dict   return l:self.a endfunction  let s:pobj = s:Parent.new('foo') echo s:pobj.getA() &quot; foo<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0427\u0435\u0442\u044b\u0440\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0446\u0435\u043b\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u042d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044e (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 extend) \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043e\u0447\u0435\u0440\u043d\u0438\u0439 \u043a\u043b\u0430\u0441\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">let s:Child = {} function! s:Child.new(a, b) dict   return extend(extend({'b': a:b}, s:Parent.new(a:a)), s:Child) endfunction  function! s:Child.setB(b) dict   let l:self.b = a:b endfunction  function! s:Child.getB() dict   return l:self.b endfunction  function! s:Child.getA() dict   return call(s:Parent.getA, [], l:self) . l:self.b endfunction<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u0441\u0435\u0433\u043e \u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u043d\u0438\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 extend, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430 (\u0434\u043e\u0447\u0435\u0440\u043d\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430). \u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432\u044b\u0437\u043e\u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0438\u0437 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0442\u0430\u043a \u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 call (\u0430\u043d\u0430\u043b\u043e\u0433 apply \u0432 JavaScript).<\/p>\n<p>  \u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 extend:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">let s:SubChild = {} function! s:SubChild.new(a, b, c) dict   return extend(extend({'c': a:c}, s:Child.new(a:a, a:b)), s:SubChild) endfunction<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h1>\u041c\u0438\u043a\u0441\u0438\u043d\u044b<\/h1>\n<p>  \u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0441\u044f, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0438\u043a\u0441\u0438\u043d\u044b:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">let s:Publisher = {} function! s:Publisher.new() dict   return extend({'listeners': {}}, s:Publisher) endfunction  let s:Class = {} function! s:Class.new() dict   return extend(extend({}, s:Publisher.new()), s:Class) endfunction<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h1>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b<\/h1>\n<p>  \u041f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u044b, \u0438 \u044f \u043d\u0435 \u043c\u043e\u0433 \u043e\u0431\u043e\u0439\u0442\u0438 \u0435\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0443 \u043c\u0435\u043d\u044f \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430. \u0427\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434 instanceof, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443 \u043a\u043b\u0430\u0441\u0441\u0430. \u0412\u0441\u0435 \u0447\u0442\u043e \u043e\u0442 \u043d\u0435\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043b\u0438 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0438 \u0435\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u041f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u0435\u0442\u043e\u0434\u044b, \u0430 \u043d\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0443\u0441\u043b\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434\u044b. \u042d\u0442\u043e \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0430\u044f &quot;<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A3%D1%82%D0%B8%D0%BD%D0%B0%D1%8F_%D1%82%D0%B8%D0%BF%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F\">\u0423\u0442\u0438\u043d\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f<\/a>&quot;.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">instanceof<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">function! s:instanceof(obj, class)   for l:assertFun in keys(filter(a:class, 'type(v:val) == 2'))     if !has_key(a:obj, l:assertFun)       return 0     endif   endfor    return 1 endfunction  echo s:instanceof(s:childObject, s:Parent) &quot; 1 echo s:instanceof(s:childObject, s:SubChild) &quot; 0<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418\u043c\u0435\u044f \u0442\u0430\u043a\u0443\u044e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">let s:Iterable = {} function! s:Iterable.valid() dict endfunction  function! s:Iterable.next() dict endfunction  function! s:Iterable.current() dict endfunction  let s:Iterator = {} function! s:Iterator.new(array) dict   return extend(extend({'array': a:array, 'cursor': 0}, s:Iterable), s:Iterator) endfunction  function! s:Iterator.valid() dict   return exists('l:self.array[l:self.cursor]') endfunction  function! s:Iterator.next() dict   let l:self.cursor += 1 endfunction  function! s:Iterator.current() dict   return l:self.array[l:self.cursor] endfunction  let s:iterator = s:Iterator.new([1,2,3]) echo s:instanceof(s:iterator, s:Iterable) &quot; 1<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u0430\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0430 \u043d\u0435 \u0435\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u043a\u0430\u043a \u0432 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u044f\u0437\u044b\u043a\u0435.<\/p>\n<h1>JSON \u2014 \u043b\u0435\u0433\u043a\u043e!<\/h1>\n<p>  \u0414\u043b\u044f \u043a\u043e\u0433\u043e \u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\u043c, \u043d\u043e JSON \u2014 \u044d\u0442\u043e \u0434\u0432\u043e\u044e\u0440\u043e\u0434\u043d\u044b\u0439 \u0431\u0440\u0430\u0442 VimScript! \u041d\u0435 \u0432\u0435\u0440\u0438\u0442\u0435? \u042f \u0432\u0430\u043c \u044d\u0442\u043e \u0434\u043e\u043a\u0430\u0436\u0443:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">JSON<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">let s:childObj = s:Child.new(1, 2) let s:json = string(filter(s:childObj, 'type(v:val) != 2')) echo s:json &quot; {'a': 1, 'b': 2} echo eval(s:json) == s:childObj &quot; 1<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h1>\u041f\u043e\u043a\u0430 \u0432\u0441\u0435<\/h1>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0432\u0430\u0441 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0438 \u043f\u043e\u0431\u0443\u0434\u0438\u0442 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a, \u0442\u043e \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0430\u0448\u0443 \u0436\u0438\u0437\u043d\u044c \u043f\u0440\u043e\u0449\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445.                 <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/278623\/\"> https:\/\/habrahabr.ru\/post\/278623\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u042f \u0441\u0447\u0438\u0442\u0430\u044e VimScript \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u043d\u044b\u043c, \u043d\u043e \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043c\u043e\u0449\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u0438\u0442\u044c, \u0447\u0435\u043c \u044f \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u0430\u043c \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u0442\u0430\u0442\u0435\u0439. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u043d\u0430 VimScript \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u044b, \u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043a\u0430\u0441\u0430\u0442\u044c\u0441\u044f \u043e\u0441\u043d\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u043c\u0441\u044f \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0441\u0442\u0430\u0432\u0448\u0438\u0445 \u043d\u0430\u043c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0439.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-275541","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/275541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=275541"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/275541\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=275541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=275541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=275541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}