首页 > 其他 > 详细

Hack 语言学习/参考---1.2 Hack Background

时间:2014-03-26 10:23:23      阅读:341      评论:0      收藏:0      [点我收藏+]

Hack Background

Facebook was initially built with PHP. Parameters and return types were specified in comments. Parsers could use this to create documentation. But type-checking was non existent.

bubuko.com,布布扣
<?php
/**
 * Wraps a name in a box
 *
 * @param raw-str $name
 * @return html-str
 */
function say_hello($name) {
  return "<div class=\"box\"<hello ".htmlize($name)."</div>";
}
bubuko.com,布布扣

 

In 2009, a PHP compiler called HipHop was released. In 2010, minor changes to the PHP language were introduced by the HPHP team to improve development time and provide basic type safety. The changes were XHP and parameter type constraints.

bubuko.com,布布扣
<?php
/**
 * Wraps a name in a box
 *
 * @return xhp
 */
function say_hello(string $name) {
  return <div class="box"<Hello {$name}>/div>;
}
bubuko.com,布布扣

 

In 2012, Facebook engineering teams started exploring the idea of annotating return types. And the Hack language was born...

Hack 语言学习/参考---1.2 Hack Background,布布扣,bubuko.com

Hack 语言学习/参考---1.2 Hack Background

原文:http://www.cnblogs.com/Jack8Chen/p/3620895.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!