Hi Tony

2017-10-31 11:35 GMT+01:00 Tony Marston <tonymars...@hotmail.com>:
> This strikes me as being nothing more than a micro-optimisation that does
> nothing but pander to the laziness of certain programmers. Instead of having
> to write a few lines of code to validate something they want the language to
> do it for them. It may come as a surprise to some people, but being a
> programmer actually involves the writing of program code. It is not
> sufficient to express an idea and have the language fill in all the details
> as that forces the language to have to detect and deal with a myriad of
> possibilities.

I do understand where you are coming from, but I don't necessarily
agree on this topic. We can (hopefully) agree that programming
language design is hard, because we need to determine how fine a line
we should have between things thats an integral part of the language,
its standard library or its extensions and how much power the
programmer has in their arsenal to do crazy things.

If we boil things down, then we didn't really need the scalar type
hints, PHP had been working perfectly fine for 20 years without it and
while it does not add anything but a couple of checks at
compile/runtime, its essentially "laziness of certain programmers" it
becomes useful to. Another example is constant visibility modifiers in
PHP 7.1.

I think one of the advocates for features that are within that
category you mention can sometimes be productivity and rid of
boilerplate code. For this case with 'Array Of', I think it makes
perfect sense to add with PHP7's improved type system on that regard,
but thats my personal opinion.

> I would evaluate each proposed change to the language with a simple question
> - does it provide the greatest good to the greatest number? Considering the
> fact that this RFC will only benefit a miniscule minority of developers yet
> make the language more complicated, slower to run, and more difficult to
> maintain as more and more edge cases are identified as "bugs", it offers
> negative benefits to the vast number of programmers who are happy with the
> language as it currently exists. As such it fails that test and should be
> rejected.

Tho you said its a micro optimization, would argue that (see [1]), it
far from makes the code complicated, internally it doesn't add any
complexity and only adds a member to the arg_info, which is an
unsigned char, it wouldn't do anything unless a type is specified
anyway and the slower to run argument above is pretty void, sure it
adds a few CPU instructions but its not something you will feel unless
you are Facebook, in which case you already re-implemented the
language on your own.

I fail to see how it offers "negative benefits to the vast number of
programmers who are happy with the language as it currently exists", I
myself don't like PDO, so I just use mysqli instead, great. If its not
something that affects the programmer and the programmers code
continue to run, I fail to see how it negatively impacts the vast
majority. If I asked you how you feel about the exif extension now
supports streams as arguments instead of only file names, would you
care much unless you are actively using the exif extension? Probably
not.


[1] https://gist.github.com/KalleZ/c7ba4f78314c989e27710e4fa14e2f3e



-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

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

Reply via email to