Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60403 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7895 invoked from network); 1 May 2012 18:34:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 May 2012 18:34:27 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pb0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:37490] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5B/9B-38165-2BC20AF4 for ; Tue, 01 May 2012 14:34:27 -0400 Received: by pbbrp12 with SMTP id rp12so3618071pbb.29 for ; Tue, 01 May 2012 11:34:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=uuXlSF7bJEHnvso37RYIDGZINUmMoL40f7KR0jEcJjw=; b=POsg46E7ELFtZh9uGyuCR5v1toJLZJiRPFy8HFk/aFDETJcW1WUPU3jYl2QTDrszwv yZhtTJn+jVOTBSx2kDUcAhqpLfQIEh6Ya+cwYB0ixzM3kmtcIdOZGniwzdAhD3TRMONn S23E1RfZ//69cVJePIxcHKMpqm/rB/p897DaYV4LPx0wQ3d9SQx6I6caeXlWqax/edCj NNIAyBN1rCY7joylGJ8Wtd8bIIUb5yNzMwWQR8SDdHHHdc6JweUGo1b0br1WadSjOFpS s4dwuPxvhi/vtaUuSirDtqNIXazy6eNDS4CPoUYTIMapmUw+s1dx+aNF2wKrm08XnLu4 kanw== MIME-Version: 1.0 Received: by 10.68.194.226 with SMTP id hz2mr1837342pbc.22.1335897263593; Tue, 01 May 2012 11:34:23 -0700 (PDT) Received: by 10.68.229.197 with HTTP; Tue, 1 May 2012 11:34:23 -0700 (PDT) In-Reply-To: References: Date: Tue, 1 May 2012 20:34:23 +0200 Message-ID: To: Patrick ALLAERT Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary=047d7b10cc31da571204befdd16a Subject: Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset() From: tyra3l@gmail.com (Ferenc Kovacs) --047d7b10cc31da571204befdd16a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, May 1, 2012 at 7:24 PM, Patrick ALLAERT wro= te: > 2012/5/1 Ferenc Kovacs : > > On Mon, Apr 30, 2012 at 2:39 PM, Nikita Popov >wrote: > > - both isset and empty are language constructs, which many people use > > almost interchangeability, changing one of them in a way that the same > > expression works with one of them, but blows up with a parse error seem= s > > wrong to me. > > I wish that more wrong usages could blow up with parse errors way > before waiting for the incorrect line to be run. > One could argue that then you should pick a compiled language. > While there is some valid use cases for empty() I see none for > isset(), it must remain a targeted and specific construct IMHO. > I agree that there is less valid use-cases, but I feel that keeping the two method consistent about this is more important. > > > - maybe you think that isset doesn't really make sense with expressions= , > > exact :) > > > but don't forget that this patch would also allow constants to be used > with > > empty/isset. > > That is not a very good think IMO. > > For the same reason: this patch would also allow writing: empty( false > ) or empty( null ) which are both clueless. > how is that different than for example writing is_null(null) ? > The fact that this patch would now allow syntactically doubtful things > doesn't mean they should be encouraged nor propagated to isset(). > we are already have that all over the place, I don't think that this particular patch will change anything about that. could you elaborate on this part a little bit? I mean you can write "stupid" code right now ($null=3Dnull;isset($null); instead of isset(null);), I can't see how would this patch worsen the situation. If anything, the silly code could be understood easier, as you wouldn't need to debug the value of the $null variable passed in. So I think that 1, we already too late to prevent that kind of code 2. even if we could, I don't think that the currently discussed patch would really encourage that kind of code 3, there are/could be valid use-cases for isset 4, isset and empty should work the same way in regards of the argument parsing. ofc. this is only my opinion, if I am the minority here, then it is fine too, I just wanted to explain what was the reasoning behind that discussion= . --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --047d7b10cc31da571204befdd16a--