> De : Lester Caine [mailto:les...@lsces.co.uk]
>
> On 17/02/15 18:33, François Laupretre wrote:
> > What does this mean in your case ? Just that, as long as the feature is not
> available, your function won't have an explicit return type. Period. And,
> please, don't change false to 0 ;).
> 
> I simply can't see the case for limited function type hints at all! I

If you can't see it after so much was written on the subject, what can we do ? 
Do you imply that, if *you* cannot understand the need, it does not exist ?

> either already have clean defined data from the database, or I need to
> validate the data from users before using it.

If that's your only data source, that's OK. I confirm you probably don't need 
type hinting. You probably even don't need functions, classes and the rest. A 
50-line script should fit.

>  While validating I need to
> confirm constraints of data type so adding some extra wrapper that only
> does half the job just seems a pointless exercise.

The point of type hinting is not validating user input.

> Annotating the
> correct data type would be of more use and I already have that in the
> docblock and my IDE produces those hints while I am writing the code -
> which it has done for many years.

That's different. There is overlapping there but the purpose is not the same. 
IDEs only can do a limited set of static analysis. As soon as you have indirect 
calls, IDE-based static analysis is down, let alone comment-stripped libraries 
and others. If you want more constraints on input and output, look at DbC 
(design by contract), as it can handle tests too slow to run in production.

 To my mind it IS in the IDE that much
> of this stuff which people keep saying is not 'runtime' should be
> managed, and anything that is not needed at 'runtime' should be
> removable but what is being added across several areas all seem to
> beadding the same things - partially - using different methods - without
> any obvious gain. Additionally I'm now passing data as an array as that
> was the 'best practice' a few years back so it is rare to be passing a
> single value anyway.

IDEs are worthwile but not mandatory and runtime features have nothing to do 
with IDEs.

Now, you were (aggressively) complaining about returning int or false. You were 
sure you had found the case that would prove all of this was ready for the bin. 
I took the time to explain. Then, you're complaining it's no use because you 
don't understand its purpose and because you chose to bundle your arguments in 
arrays...

Unfortunately, I'm afraid I can't do more for you but what I generally hate : 
'If we don't like it, don't use it'.

I try to be kind with constructive posts but, here, I have better to do.

François


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

Reply via email to