{"id":10320,"date":"2014-12-15T16:17:30","date_gmt":"2014-12-15T21:17:30","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=10320"},"modified":"2024-09-25T16:09:01","modified_gmt":"2024-09-25T20:09:01","slug":"hack-transpiler","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2014\/12\/15\/hack-transpiler\/","title":{"rendered":"Hack Transpiler"},"content":{"rendered":"<p><a href=\"https:\/\/code.facebook.com\/posts\/398235553660954\/announcing-the-hack-transpiler\/\">Facebook<\/a>:<\/p>\n<blockquote cite=\"https:\/\/code.facebook.com\/posts\/398235553660954\/announcing-the-hack-transpiler\/\"><p>Today, we&rsquo;re proud to announce a first, experimental release of <a href=\"http:\/\/docs.hhvm.com\/manual\/en\/install.hack.h2tp.php\"><code>h2tp<\/code><\/a>, or the &ldquo;HH (Hack) Transpiler,&rdquo; a tool which allows projects that have converted from PHP to Hack to still make releases that target the PHP language.<\/p>\n<p>[&#8230;]<\/p><p>But transforming Hack code using collections is not merely about using equivalent constructs from the hacklib library. For example, on HHVM, empty Hack collections universally convert to <code>false<\/code> when used in a boolean context, something a standard PHP object can never do. This means that any arbitrary expression or statement that involves a boolean comparison, or any cast, might invoke this special rule if it involves a collection. So unless the expression being treated as boolean is trivially not a collection, we have to treat it as if it might potentially contain a collection. Hence, we have to be very cautious when making transformations.<\/p>\n<p>[&#8230;]<\/p>\n<p>In a few rare cases we actually have to choose not to support a feature. For instance, we do not support Instance variables using literal syntax in the class declaration.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Facebook: Today, we&rsquo;re proud to announce a first, experimental release of h2tp, or the &ldquo;HH (Hack) Transpiler,&rdquo; a tool which allows projects that have converted from PHP to Hack to still make releases that target the PHP language. [&#8230;]But transforming Hack code using collections is not merely about using equivalent constructs from the hacklib library. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2024-09-25T20:09:03Z","apple_news_api_id":"b3514281-b3f9-408f-8447-06587c1be2ce","apple_news_api_modified_at":"2024-09-25T20:09:03Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/As1FCgbP5QI-ERwZYfBvizg","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[255,25,815,470,359,71,2660],"class_list":["post-10320","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-compiler","tag-facebook","tag-hack-lang","tag-hhvm","tag-php","tag-programming","tag-transpiler"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=10320"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10320\/revisions"}],"predecessor-version":[{"id":10321,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10320\/revisions\/10321"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=10320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=10320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=10320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}