I get that a lot of people think that the only way forward with PHP is
fully typed, strict checking and blocking anything that may be deemed to
be risky. However PHP7 has not yet dropped the simple object-less style
of programming that it originally developed from. That is why tidying up
a simple procedural style of working still has a place. The debate on
'exists()' or to give it a tidier title 'variable_exists()' is more
about just how much of a procedural style of programming remains in PHP
in the future. Yes there are other ways of working, and using
associative arrays direct gives a different set of tools, which then
morph again in objects, and it's the piecemeal way things have been
bolted on which has caused that so that the 'simple' functions have
fallen through the gaps?
array::exists() and object::exists() would have been tidy extensions to
exists() if one was starting again with a clean sheet, but we have what
we have and procedural PHP is still integral so can we please just clean
up the gaps rather than pushing 'more modern' ways of working.
--
Lester Caine - G8HFL
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
I get that a lot of people think that the only way forward with PHP is
fully typed, strict checking and blocking anything that may be deemed
to
be risky. However PHP7 has not yet dropped the simple object-less style
of programming that it originally developed from. That is why tidying
up
a simple procedural style of working still has a place. The debate on
'exists()' or to give it a tidier title 'variable_exists()' is more
about just how much of a procedural style of programming remains in PHP
in the future.
I agree with the sentiment, but I'm not sure "procedural" is the right keyword here. I know of no other language, however procedural, that allows easy examination of the local symbol table to see if a variable exists. Nor do most procedural languages allow "variable variables" and functionality like extract()
and compact()
. However, I take the point that, whatever name we give it, this is a style of coding PHP goes some way to supporting, and there's no fundamental reason not to expand that support.
The main risk with a multi-paradigm language is it becoming "Jack of all trades, master of none", either because the features themselves are sub-standard, or because people use features designed for one style of coding as stand-ins for other styles. e.g. mixing variable variables and object composition is likely to lead to some confusion.
Regards,
Rowan Collins
[IMSoP]
On 19 September 2015 10:48:17 BST, Lester Caine lester@lsces.co.uk
wrote:I get that a lot of people think that the only way forward with PHP is
fully typed, strict checking and blocking anything that may be deemed
to
be risky. However PHP7 has not yet dropped the simple object-less style
of programming that it originally developed from. That is why tidying
up
a simple procedural style of working still has a place. The debate on
'exists()' or to give it a tidier title 'variable_exists()' is more
about just how much of a procedural style of programming remains in PHP
in the future.I agree with the sentiment, but I'm not sure "procedural" is the right
keyword here. I know of no other language, however procedural, that allows
easy examination of the local symbol table to see if a variable exists. Nor
do most procedural languages allow "variable variables" and functionality
likeextract()
andcompact()
. However, I take the point that, whatever name
we give it, this is a style of coding PHP goes some way to supporting, and
there's no fundamental reason not to expand that support.
Not to forget that something like variable_exists() would have to be a
language-level statement to avoid notices being raised.
So while having a more consistent syntax would be kinda sweet, we'd be
stuck with maintaining BC forever, and there will always be those "it's not
as simple as that" cases.
I think there are much better uses of the community's time.
- Stig