On 05/01/2018 09:50, Lester Caine wrote:
'Simply' adding a crude type check with it's overheads does not remove the
validation requirements which still need to be handled much of the time.

Yes, I'd love to be able to define custom types like "integer in the range 0 to 100" or whatever.

But 'error' may not be the right response EVEN with just the simple type check

I think one of the big distinctions is between validation of a value being received from somewhere (can only happen at runtime), versus verifying the validity of a piece of code (would ideally happen at compile time).

Maybe we could have a different syntax to define a function with a compile-time constraint that the value was provably of the right type. With custom types, that could then prove that some validation check had already passed.

That's kind of what the offline type checkers that other languages offer do, it's just up to you to run them before deploying your code somewhere important.


Rowan Collins

PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to