Re:Hack: a new programming language for HHVM
by wvenable on Thursday March 20, 2014 @01:01PM
(#7436875)
PHP is based on C. It's way more consistent with C, Java, C# , etc to do the former. So the real question is why
function foobar() : int { .. }
instead of function int foobar() { .. }
Re:Hack: a new programming language for HHVM
by amenghra on Thursday March 20, 2014 @01:18PM
(#7437030)
1. function foobar() makes it easier to grep for.
2. if I recall correctly, it made some parts of the grammar easier.
Re:Hack: a new programming language for HHVM
by wambotron on Thursday March 20, 2014 @01:37PM
(#7437196)
Yeah, you could go either way on it really. It seems weird to mix them, though!
Re:Hack: a new programming language for HHVM
by Rican7 on Thursday March 20, 2014 @01:03PM
(#7436893)
Its not just inconsistent with other languages, its consistent with their own language.
Property types are declared before the property name, while function return types are declared after (and with a colon).
Very strange.
Re:Hack: a new programming language for HHVM
by fzltrp on Thursday March 20, 2014 @01:38PM
(#7437204)
If you look at the original C syntax for function types, it is also a bit weird: part of the type (the return type) is placed before, and part (the parameters) after.
That syntax in hack seems more "functional" to me. That said, I must admit that I kind of like the C syntax, because of its oddity.
Re:Hack: a new programming language for HHVM
by fauigerzigerk on Thursday March 20, 2014 @03:38PM
(#7438035)
But inconsistency is consistent with PHP's philosophy ;-)
public string $x = '';
instead of
public $x:string = '';
It seems inconsistent to me, probably because I've used AS3/Haxe.