Leggo su un post di G+ Facebook Introduces 'Hack,' the Programming Language of the Future<http://www.wired.com/wiredenterprise/2014/03/facebook-hack> <http://www.wired.com/wiredenterprise/2014/03/facebook-hack>Lo ammetto sono curioso come unamangusta curiosa e vado a lurkare. Provo le prime pagine del tutorial e .... ecco il mio commento. Poi magari mi sbaglio e diventa il nuovo PHP .... beh sapete bene cosa io pensi del PHP.
Ah gira come virtual u HipHop. ===8< CUT HERE >8=== A big shoot but who guarantee us that have a future this language? 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 // ^-- FIXME: replace <?php with <?hh // A Hack file always starts with <?hh Great! In python I dont' say anything, is the interpreter that evaluate if the cose is Python and is right. <?hh // Hack functions are annotated with types. function my_negation(bool $x): bool { return !$x; } // FIXME: annotate this function parameter // and return with the type 'int'. function add_one(/* TODO */ $x): /* TODO */ { return $x+1; } Wonderful, the hated $ sign for the variables again. Doesn't start very good. Go ahead. <?hh /* Hack errors come in multiple parts. * Hover over the underlined parts! */ YES THE FIRST IS WHEN YOU ADOPT IT! (n.d.r.) function add_one(int $x): int { return $x+1; } function test(): void { $my_string = 'hello'; // Some clever code ... IT'S AN IMPOSSIBLE MISSION WRITE "CLEVER" CODE (n.d.r.) add_one($my_string); } Got an error? Wow! The other languages ... too. SO where's the new? Proceed with tutorial. <?hh // Prefixing a type with '?' permits null. // TODO: fix the type of the parameter $x to permit null. function f(int $x): void { var_dump($x); } function test(): void { f(123); f(null); } Really smart! Use a sign as '?'' to permit null. Mmm, why I suppose that they have smoke something really bad? <?hh interface User { public function getName(): string; } function get_user_name(?User $user): string { if($user !== null) { // We checked that $user was not null. // Its type is now 'User'. /* TODO: return $user->getName() */ } return '<invalid name>'; } function test(User $user) { $name1 = get_user_name($user); $name2 = get_user_name(null); } No! The !== no! I can't' go ahead. Shit! As Facebook too. ===8< CUT HERE >8=== Carlos -- 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)
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python