Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51225 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36271 invoked from network); 5 Jan 2011 18:05:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2011 18:05:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=kkooporation@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=kkooporation@googlemail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.161.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: kkooporation@googlemail.com X-Host-Fingerprint: 209.85.161.170 mail-gx0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:56253] helo=mail-gx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 22/BA-10843-FD2B42D4 for ; Wed, 05 Jan 2011 13:05:20 -0500 Received: by gxk20 with SMTP id 20so7997644gxk.29 for ; Wed, 05 Jan 2011 10:05:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:received:from:date :x-google-sender-auth:message-id:subject:to:content-type; bh=OPS3+m9nfq5KVOFNvk4ui3LFlTbXSUotglQ8hP3w2Q8=; b=wFqnOA9g8qE859bhIVDpvTliZCLA49TxHREhrDL/clrCkdEKQX2UJoUlSPGktI1mqH V6Pv3pHON0x12ZFkjIgVZgDCL1Eq9z4/InusSFtAjeNYOesqvwb+K7tsfFnLiAzEEghv swuMNEBBTpzAxqLWTSTlzMjLnzytFwrLUhbL0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:sender:from:date:x-google-sender-auth:message-id :subject:to:content-type; b=s4qZTru4e+mSN7K3ZPlhg1y12ynnJVgU+Hb7tTI5IOun2dPf41KN0znc0pR1MzbyI1 cyC0iz2nRhLmw5+uFw458MMB0gvvZh+Ocad7GtJrocamrLVC2L7LD7bYghC8jtgHI7Bv HsgnNav5oGMOgicCrEdYDx5vruR5KRKjq7884= Received: by 10.236.108.50 with SMTP id p38mr11608474yhg.84.1294250716028; Wed, 05 Jan 2011 10:05:16 -0800 (PST) MIME-Version: 1.0 Sender: kkooporation@googlemail.com Received: by 10.236.105.170 with HTTP; Wed, 5 Jan 2011 10:04:41 -0800 (PST) Date: Wed, 5 Jan 2011 19:04:41 +0100 X-Google-Sender-Auth: SbcLQP4WhSPOv6pOTnfcgmQUlgA Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=90e6ba4fbf9c2de12404991d3ab3 Subject: "undefined dummy-constant" From: Kenan@Sulayman.org (Kenan Sulayman) --90e6ba4fbf9c2de12404991d3ab3 Content-Type: text/plain; charset=UTF-8 Hello out there. Recently when I was working on a project, the idea came to my mind: allowing the usage of undefined "dummy"-flags. When I am speaking of "undefined dummy-constant", I mean if a variable is being assigned the constant - and considering it's not defined - the constant is being internally assigned an unique value. It's complicated to explain. Maybe, a snippet of code makes you understand my idea: x; } } $k = new XX; if ( $k->foo() == __XS ) { // -- this has been achieved without explicit definition of XX->x!! } // or this way: $x = __FOO; $y = __NOOB; $z = __FOO; if ( $x == $y ) { print "This should then not be shown"; } elseif ( $y == $z ) { print "This should then not be shown either"; } elseif ( $x == $z ) { print "This would then be finally shown"; } ?> The idea behind the implementation - if possible - would then be, in order to make this and constants work together, it could be checked this way: If an undefined value is BEING ASSIGNED to a variable or returned by a function, PHP defines it and assigns an unique - internal - value. If an undefined value is NOT BEING ASSIGNED and NOT YET DEFINED and, for instance, used in another context - like usage in a function or if-clause, PHP falls back to the "Use of undefined constant". I do not want to allow something like: __X = 2 (__X === 2), but something like $x = FF; $y = DD; ($x === $y), I think of the dummy-constants not really being something with a value, but rather something for "identification" of values. ---- This might be considered as a request for comments. ---- Thanks for reading, -- *Kenan Sulayman* *Freelance Designer and Programmer* --90e6ba4fbf9c2de12404991d3ab3--