Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59999 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95796 invoked from network); 16 Apr 2012 13:16:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Apr 2012 13:16:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=simonsimcity@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=simonsimcity@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: simonsimcity@googlemail.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:60151] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/25-05733-09B1C8F4 for ; Mon, 16 Apr 2012 09:16:01 -0400 Received: by obbup16 with SMTP id up16so4586obb.29 for ; Mon, 16 Apr 2012 06:15:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=GDpgT/RyvUbUrQ6NyBg7rMdWvX31AjIuZbrDQcBopdY=; b=KU73d8L4CPPAsv0x+TjLoJY6DBITniZk/Dh+jnJb/pVyEXU0x2b+CQ4ASM2MLWh1gu R8dwLiSUCPOX894LvQAr8ZJtRyO8creuuRJNmu6jLfhQ/tlI85rD7pxe0VoUYYPNvo0p hgPcX9IeWKixzYa8PCAxViNVTIdHC7iHHdg+N19Vo0uYWanANiMfvYBjJc7ubOdPLBNZ 1oVa49xwFjPwf1OpC4DiCaueD8q+yuGnqiaTpZMxo2AV/CDVucM1RxlPX1ElR55vQNxB 9mMNX/RAiOaTHhg7gltCw3kYRUS9V4oQUPKWnzzByryRF+EmpAHPpcOjDCVVoUIdg91J Yjtw== MIME-Version: 1.0 Received: by 10.182.192.39 with SMTP id hd7mr15540064obc.47.1334582158175; Mon, 16 Apr 2012 06:15:58 -0700 (PDT) Received: by 10.60.98.74 with HTTP; Mon, 16 Apr 2012 06:15:58 -0700 (PDT) In-Reply-To: <4F8C16B5.7000103@ralphschindler.com> References: <4F89D4F1.8070009@ralphschindler.com> <4F8B766F.3000702@ralphschindler.com> <4F8C16B5.7000103@ralphschindler.com> Date: Mon, 16 Apr 2012 15:15:58 +0200 Message-ID: To: Ralph Schindler Cc: internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] New Feature: Fully qualified class name resolution as scalar with class keyword From: simonsimcity@googlemail.com (Simon Schick) 2012/4/16 Ralph Schindler > > ... PHP does not invoke the autoloader to determine if the class name > actually exists as a declaration somewhere, it simply resolves it accordi= ng > to some very specific rules (in the case of this patch, carried out by > zend_resolve_class_name()). > > If I am within a namespace and am using a short name without a preceding > "\", it means the class I am referencing exists in the current namespace. > =C2=A0Whether or not that class exists is irrelevant as my short name can= only > mean "a class by this name in the current namespace". =C2=A0In this code: > > =C2=A0namespace Foo\Bar { > =C2=A0 =C2=A0global $foo; > =C2=A0 =C2=A0if ($foo && $foo instance Bar) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0// ... > =C2=A0 =C2=A0} > =C2=A0} > > ... that you, the developer, intend that your reference to Baz actually > means "Foo\Bar\Baz", it can never mean anything else. > > So, in a nutshell, there is no guessing going on ;) > -ralph Hi, Ralph Agree on that. I'd like to have a comment in the test, specially for this line where you're checking for non-existing classes. It does not seem to be obvious what should be tested here (at least it was not obvious for me). This may make it easier to fix stuff if this test should fail in future. I don't know if this here is the right test to put the comment in, but it's at least relying on something global that may change. Thanks for giving me a deeper knowledge here :) Bye Simon