Web lists-archives.com

[PHP] Re: var keyword deprecation/removal




On 06 Mar 2016 at 20:29, Larry Garfield <larry@xxxxxxxxxxxxxxxx> wrote: 

> On Sun, Mar 6, 2016, at 5:17 AM, Tim Streater wrote:
>
>> Strict typing is something languages should be moving away from. As fast
>> as possible.

> Except that the trend of late has been back toward explicit typing,
> because explicit types are incredibly useful for managing medium to
> large code bases.  Duck typing doesn't scale to large code bases well,
> even though it simplifies many tasks for smaller code bases or for
> investigatory code.  There's only 70 years of computer science research
> saying that explicit types are incredibly useful in a wide variety of
> situations.

Writing an app with about 10k lines of PHP and 15k lines of javascript, I've had very few problems caused by lack of strict types. By contrast, trying to port this to an IDE, which does have strict types, has caused large amounts of my time to be wasted worrying about types and converting between them. I'm working through these but I don't expect to come out at the end thinking "Oh, thank goodness for strict types!" Even with something simple like:

  $flt = 3.75;
  $int = 12;
  echo "My float is: " . $flt . " and my int is: " . $int;

After this conversion I expect the app to run faster, generally, but that's going to be mostly because the js side of the app is not having to communicate with the PHP side of the app through the narrow pipe of ajax, rather than because the compiler can generate much more efficient code knowing that x is an int and y is a float.

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php