Hi Rasmus,

While I agree with your general point regarding consistency, I just want to
take issue with sentence:

On 11 June 2018 at 15:12, Rasmus Schultz <ras...@mindplay.dk> wrote:

> Hack made some very regrettable decisions in this area, and ultimately
> those features were useful at design-time only, for IDE-support - but
> we have php-doc for that purpose, and in my opinion, adding those
> features before (or unless) we're willing/able to also make them work
> consistently with the language, does more harm than good.



As far as I know, every other language which has added type annotations to
a dynamically typed language has done so either using an offline tool
(treating them like compiler warnings), or as a debug-only run-time flag
(treating them like assertions). The creator of "gradual typing", which is
explicitly the basis of Python's type annotations, and at least implicitly
used by many other languages, specifically stated that it was intended to
be checked at compile-time, not run-time [1]:

> A *gradual type checker* is a type checker that checks, at compile-time,
for type errors in some parts of a program, but not others, as directed by
which parts of the program have been annotated with types.

Arguably, it is PHP which made the regrettable decision in adding run-time
type hints in the first place. If we removed those, we could implement
gradual typing, and maybe add an ability to reflect on the type
annotations, without the headache of how this interacts with run-time
performance.

Nonetheless, we are where we are, so I agree that it would be bad now to
add type annotations which did not behave at run-time like the existing
ones.

[1] http://wphomes.soic.indiana.edu/jsiek/what-is-gradual-typing/

-- 
Rowan Collins
[IMSoP]

Reply via email to