Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51898 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42587 invoked from network); 14 Apr 2011 13:25:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Apr 2011 13:25:40 -0000 Authentication-Results: pb1.pair.com header.from=mail_ben_schmidt@yahoo.com.au; sender-id=unknown; domainkeys=good Authentication-Results: pb1.pair.com smtp.mail=mail_ben_schmidt@yahoo.com.au; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain yahoo.com.au from 98.139.213.150 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: mail_ben_schmidt@yahoo.com.au X-Host-Fingerprint: 98.139.213.150 nm5-vm0.bullet.mail.bf1.yahoo.com Received: from [98.139.213.150] ([98.139.213.150:44407] helo=nm5-vm0.bullet.mail.bf1.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/40-40161-2D5F6AD4 for ; Thu, 14 Apr 2011 09:25:40 -0400 Received: from [98.139.212.151] by nm5.bullet.mail.bf1.yahoo.com with NNFMP; 14 Apr 2011 13:25:36 -0000 Received: from [98.139.212.231] by tm8.bullet.mail.bf1.yahoo.com with NNFMP; 14 Apr 2011 13:25:36 -0000 Received: from [127.0.0.1] by omp1040.mail.bf1.yahoo.com with NNFMP; 14 Apr 2011 13:25:36 -0000 X-Yahoo-Newman-Id: 100993.30497.bm@omp1040.mail.bf1.yahoo.com Received: (qmail 8287 invoked from network); 14 Apr 2011 13:25:35 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.au; h=DKIM-Signature:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=Y8WI1Lgok3oNPEmxnQaA2OSgP/xYe21hQt5s77AlxuZlhLJoYlZmZMPIqcF1IoP1nwTdu4augh1+bizMOE0FmpG9bFQxBbg+Sk3nWwc+vkDF8OZS5dOO28/0yDC9BViyqd3+7bK+gLfZbuY25P1BILMPY/ss1OJ3JpstYePrIlA= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.au; s=s1024; t=1302787535; bh=rD7vQlOF7PzzuSmW2+amuMsQpJsJ4NvViNMqluABZOI=; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=AV7/1bj0IsT1QFrQisAdbCFPtgxSwrz80bfyhkdybN7yEoUqpD5+V3sfL45Vu9tnmE/YeUbsZASzXkM+UGS9FECz6Q7qr2skZ12/YUF09/axxVMy0tWhmi6Hp5oNnGSXI7bMlbhQn7/VpKQkMElC0vlboHEfAzidp4NnuMCWBDY= Received: from thought.local (mail_ben_schmidt@124.168.69.175 with plain) by smtp133.mail.mud.yahoo.com with SMTP; 14 Apr 2011 06:25:34 -0700 PDT X-Yahoo-SMTP: enFMnPSswBAexaHyzgobwuUTrYOhZdJ0KRA2SjA- X-YMail-OSG: Rn3xF9oVM1mSbLeojTvKMzsf_iv0RNRqYKevMOQT5DBMpcS lPq.DBUSv9h6FhwW7eqGtNxTUtuNK.OLVk5CQlXX6eFLJQRzZlonBsCGqF4D H1NeHy6qOIZv7kpA9_.eUrQdYgny776fszMnJU7D0B9.4rb7r4xd6qZgbukG .ZNSP8NVMQCuJE84L.5GuoYZYOKfRJyepbRWswba6slIZXZSELNvORyrVNOE UoHv1XOwExm257LnnQ819RzL_9wb61C6t4Sm2pxNlG7C9326z2141CkjuC2s TYG0Phf6VYCyZ7CA6xPh5AeSsaYaZpZnc9xM3Am2ynf32XqDR3A_wwinKszN 90qznX8EIhEzQktebBV6WJgnwYw-- X-Yahoo-Newman-Property: ymail-3 Message-ID: <4DA6F5D4.7070207@yahoo.com.au> Date: Thu, 14 Apr 2011 23:25:40 +1000 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 ThunderBrowse/3.3.5 MIME-Version: 1.0 To: David Muir CC: internals@lists.php.net References: <4D950434.3060704@yahoo.com.au> <4D9E0543.1080600@lerdorf.com> <69.82.36433.EC33E9D4@pb1.pair.com> <4D9E34C4.5000406@lerdorf.com> <4D9E429B.20503@sugarcrm.com> <4D9E96B6.6060401@lerdorf.com> <718216446.20110408143441@cypressintegrated.com> <4DA0E71C.9030008@gmail.com> <4DA63ED8.4080402@yahoo.com.au> <4DA65BEC.8000809@gmail.com> In-Reply-To: <4DA65BEC.8000809@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator From: mail_ben_schmidt@yahoo.com.au (Ben Schmidt) > I cry whenever I see code with @ in it... I don't like @ either. The whole point of this proposal though is to offer a safe alternative, a way to suppress only those notices which are being accounted for by the programmer and no more, without messing around making a custom error handler that ignores one type of error, which is the current way to do it 'safely'. > What we're wanting are existential assignment and ternary operators. > Simply put, a painless way to set or use a default value based on the > existence of a variable without needing a bunch of extra code to avoid > notices/errors. Sorry Ben, but I think extending the @ operator to > prevent errors from being generated in the first place is a terrible > idea. I would prefer to see @ removed from PHP if possible. I never meant to extend @, I meant simply to reuse that symbol--i.e. the @ character--as part of the syntax of a new safer feature, since it performed a similar function. The actual @ operator is not changed in any way. Rather, a new @[...] array indexing mechanism is added which suppresses the Undefined Index notice, and only that notice, by not generating it. > I would also want this to work with objects and scalars. It would be > particularly useful within view scripts where the values are passed in > via extract, or as object properties, and you can't instantiate them > first because that would clear them. I guess that's a vaguely valid use case, though I still somewhat think it is the responsibility of the caller of the view script to ensure all variables are instantiated (to null if appropriate). I guess an unambiguous syntax for this could be $@variable. I guess object properties are another case. I wonder how common. I guess $object@->property would be the way to deal with that. I still lean towards just offering it for arrays, though. That seems to be the area of greatest need by a significant margin. Ben.