On 02/20/2015 09:39 AM, Anthony Ferrara wrote:
> I think if anything, the appearance of Hack (and its adoption) show
> that people want static typing, at least to some level...

To be perfectly transparent here though, you should mention that your
proposed RFC goes well beyond the strict typing that is in Hack because
in Hack the internal API is largely untyped while your proposal is to
default the entire internal API to strict types in strict mode. Also, in
Hack there is a distinction between the off-line hh_client type-checker
and the runtime.

Hack examples all using <?hh // strict

  echo number_format('1000');
  echo htmlspecialchars(1000);
  echo md5(1000);

These are all fine both as far as the type-checker is concerned as well
as the runtime, of course, but they are runtime fatals in your proposed RFC.

And if you only go by the runtime and ignore the out-of-band type
checker there are almost no strictness rules applied to the internal API
in Hack.

eg.  explode(0, 1000);

Here the hh_client type checker will complain that it is expecting
strings, but the runtime will run it nicely.

So when you say, and as I have heard other people say, that people want
Hack-like strict typing, you have to be a bit careful about what is
meant by that. Even in the cases where the internal API is typed in
Hack, it is still not a runtime fatal if they are called with the wrong
types. Now whether that is a good thing or not is debatable, of course,
my point is simply that if you are going to use Hack adoption as a sign
"that people want static typing" you should clearly explain that your
approach is quite different from what Hack is doing.

-Rasmus


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to