Re: Coding styles ...
| From: | Stig Bakken | Date: | Tue, 22 Sep 2015 08:54:43 +0000 |
| Subject: | Re: Coding styles ... | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88401@lists.php.net to get a copy of this message | ||
On Sep 19, 2015 15:50, "Rowan Collins" <rowan.collins@gmail.com> wrote:
>
> 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
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.
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