<div dir="ltr"><div class="gmail_extra">Leggo su un post di G+</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="http://www.wired.com/wiredenterprise/2014/03/facebook-hack" target="_blank" class="" tabindex="0" style="color:rgb(66,127,237);text-decoration:none;display:block;overflow:hidden;text-overflow:ellipsis;outline:none;font-size:16px;font-family:Roboto,arial,sans-serif;line-height:1.4;max-height:157px">Facebook Introduces 'Hack,' the Programming Language of the Future</a><a href="http://www.wired.com/wiredenterprise/2014/03/facebook-hack" target="_blank" class="" tabindex="0" style="color:rgb(66,127,237);text-decoration:none;display:block;overflow:hidden;text-overflow:ellipsis;outline:none;font-size:16px;font-family:Roboto,arial,sans-serif;line-height:1.4;max-height:157px"><br>
</a>Lo ammetto sono curioso come unamangusta curiosa e vado a lurkare. Provo le prime pagine del tutorial e .... ecco il mio commento.</div><div class="gmail_extra">Poi magari mi sbaglio e diventa il nuovo PHP .... beh sapete bene cosa io pensi del PHP.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Ah gira come virtual u HipHop. </div><div class="gmail_extra"><br></div><div class="gmail_extra">===8< CUT HERE >8===</div><div class="gmail_extra"><br></div>
<div class="gmail_extra"><span style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">A big shoot but who guarantee us that have a future this language? </span><br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<span style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">I have read that "move from the old dynamically typed system to a statically typed arrangement". Mm great! Come back to the nehanderthalian programming ;P</span><br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
// ^-- FIXME: replace <?php with <?hh</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">// A Hack file always starts with <?hh<br></div><br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<span style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">Great! In python I dont' say anything, is the interpreter that evaluate if the cose is Python and is right.</span><br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<?hh</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
// Hack functions are annotated with types.</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">function my_negation(bool $x): bool {</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
return !$x;</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">}</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">// FIXME: annotate this function parameter</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
// and return with the type 'int'.</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">function add_one(/* TODO */ $x): /* TODO */ {</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
return $x+1;</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">}</div><br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<span style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">Wonderful, the hated $ sign for the variables again. Doesn't start very good. Go ahead.</span><br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<?hh</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
/* Hack errors come in multiple parts.</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"> * Hover over the underlined parts!</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
*/</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><br>YES THE FIRST IS WHEN YOU ADOPT IT! (n.d.r.)<br><br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
function add_one(int $x): int {</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"> return $x+1;</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
}</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
function test(): void {</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"> $my_string = 'hello';</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
// Some clever code ...<br>IT'S AN IMPOSSIBLE MISSION WRITE "CLEVER" CODE (n.d.r.)</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><br>
add_one($my_string);<br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">}</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br></div><span style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">Got an error? Wow! The other languages ... too. SO where's the new?</span><br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<span style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">Proceed with tutorial.</span><br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<?hh</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
// Prefixing a type with '?' permits null.</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
// TODO: fix the type of the parameter $x to permit null.</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">function f(int $x): void {</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
var_dump($x);</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">}</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">function test(): void {</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
f(123);</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"> f(null);</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
}</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><br>Really smart! Use a sign as '?'' to permit null. Mmm, why I suppose that they have smoke something really bad? </div>
<span style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"> </span><br style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><?hh</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">interface User { public function getName(): string; }</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">function get_user_name(?User $user): string {</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"> if($user !== null) {</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
// We checked that $user was not null.</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"> // Its type is now 'User'.</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"> /* TODO: return $user->getName() */</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
}</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"> return '<invalid name>';</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
}</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><br></div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
function test(User $user) {</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px"> $name1 = get_user_name($user);</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
$name2 = get_user_name(null);</div><div style="color:rgb(0,0,0);font-family:Roboto,arial,sans-serif;font-size:13px;line-height:18.200000762939453px">}<br><br>No! The !== no! I can't' go ahead. Shit! As Facebook too.</div>
===8< CUT HERE >8===<br clear="all"><div><br></div><div>Carlos</div>-- <br><div dir="ltr"><font face="arial">Coloro che sognano di giorno sono uomini pericolosi, perche' sono capaci di recitare a occhi aperti il loro sogno fino a renderlo possibile. Ed e' questo che feci anch'io. - (T.E. Lawrence) </font></div>
</div></div>