{"id":165561,"date":"2020-10-09T22:08:10","date_gmt":"2020-10-09T14:08:10","guid":{"rendered":"http:\/\/4563.org\/?p=165561"},"modified":"2020-10-09T22:08:10","modified_gmt":"2020-10-09T14:08:10","slug":"%e5%85%b3%e4%ba%8e-kotlin-%e7%9a%84%e5%86%85%e8%81%94%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=165561","title":{"rendered":"\u5173\u4e8e kotlin \u7684\u5185\u8054\u51fd\u6570"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5173\u4e8e kotlin \u7684\u5185\u8054\u51fd\u6570               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : MakHoCheung <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u6709 kotlin \u5927\u4f6c\u5417\u3002\u7531\u4e8e kotlin \u8981\u517c\u5bb9 java6\uff0c\u65e0\u6cd5\u7528\u5230 invokedynamic\uff0c\u6240\u4ee5\u624d\u4f1a\u6709 inline \u51fd\u6570\u7684\u5b58\u5728\uff0c\u4f46\u662f\u5982\u679c\u6211\u7684\u7f16\u8bd1\u76ee\u6807\u662f java8 \u4ee5\u4e0a\u7684\u8bdd\uff0ckotlin \u7f16\u8bd1\u5668\u4f1a\u4f18\u5316\u6210 invokedynamic \u5417\uff0c\u8fd9\u6837\u5c31\u4e0d\u7528\u5199 inline \u51fd\u6570\u4e86<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3656217\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : MakHoCheung <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             You never need to use inline functions. (I believe) they are purely there for free performance optimizations to prevent extra object creation at runtime. It achieves this by essentially turning the function into a macro and copying that function wherever it&#8217;s used. Generally there&#8217;s no point unless it&#8217;s a higher order function. (And intelij will tell you this if you use it without need). Although I wouldn&#8217;t call myself super experienced with kotlin so I could just be spewing garbage.<\/p>\n<p>\u660e\u660e\u90fd\u8bf4\u4e86\u6709\u6027\u80fd\u4f18\u5316\uff0c\u8001\u5916\u7684\u56de\u7b54\u5c45\u7136\u8bf4\u4e0d\u9700\u8981 inline \u51fd\u6570                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3656218\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SoloCompany <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             inline \u51fd\u6570\u4e0d\u4ec5\u4ec5\u662f\u9762\u5411\u6027\u80fd\u4f18\u5316\u8fd9\u4e48\u7b80\u5355, \u6700\u91cd\u8981\u7684\u5dee\u522b\u662f inline function \u5141\u8bb8\u8df3\u51fa\u5f53\u524d\u63a7\u5236\u6d41\u6bd4\u5982\u5806\u6808\u800c\u666e\u901a\u51fd\u6570\u4e0d\u53ef\u4ee5<\/p>\n<p>\u6bd4\u5982\u6700\u5178\u578b\u7684 let \/ run \u53ef\u4ee5\u7528\u5728\u4efb\u610f\u5730\u65b9, \u53ef\u4ee5 break \/ return, \u548c\u4f60\u6240\u7406\u89e3\u7684 keyword \u6ca1\u6709\u4efb\u4f55\u4e0d\u540c, \u5982\u679c\u4e0d\u662f inline \u662f\u4e0d\u53ef\u80fd\u505a\u5230\u7684                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3656219\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : MakHoCheung <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @SoloCompany \u53d7\u6559\u4e86\u5927\u795e                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5173\u4e8e kotlin \u7684\u5185\u8054\u51fd\u6570 \u8cc7&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/165561"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=165561"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/165561\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=165561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=165561"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=165561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}