Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93826 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31095 invoked from network); 5 Jun 2016 21:49:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2016 21:49:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.67 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.218.67 mail-oi0-f67.google.com Received: from [209.85.218.67] ([209.85.218.67:35980] helo=mail-oi0-f67.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A3/A3-09778-15E94575 for ; Sun, 05 Jun 2016 17:49:05 -0400 Received: by mail-oi0-f67.google.com with SMTP id n3so5588055oig.3 for ; Sun, 05 Jun 2016 14:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=27vw+bh3nO6ENSIYe7TR2cMXWv3JpR7G6MnpBSOlUws=; b=tfOpT7OdpP0iPx4s5IL3F6k8RgEK9uKtaFRi+1V6KaNGTJJXMIVFIB/tZaNL3FguW0 /te3Ub/rdXzIavh4KkXVg4nJMhh83opyRJcmUKDZDNW3qab13wQVzVtSo24PVeXGUbWL JPUAunHy+Exa8VRN+b2ympqGFqXjn3L9fGBTy8J5NyCHaKEmzCX5lLnfKaROLO1jq5nw VQagZm5fagNn596bUh+GcRs1HXBgMuKwD/vCXOWvZjZz7u7YAIE+rhEY59S89zyiIR8t acEqDUEN26lowyOqJOs1I+etxfWyvK7n4UKlXGK6L2iQLOJ9P27dRp8z6Frccroj5JZY 1OSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=27vw+bh3nO6ENSIYe7TR2cMXWv3JpR7G6MnpBSOlUws=; b=NcFv2Vs0VuYD+rHjwgePYl2EhmdQM6O683/dc1I92/QxjLOTLJMlFYme8CdGWpsxI9 kIzaGIYcEDLUiqv/sW2z1yXahV3GKtFVCZEMdfUJREW75+OUkXraNgQEhABAtaMf1GFc vNqEJA7Xemz7mMnpDX5AVHF3zw9sELCFhRr+uW/78lZXPsj+i/9P8KDv6zmp601+R+uE Q2rZr/JUuws5gDtTX7mza1WHzr66O/Jxf+igCtbrAAahnjuoYwZFAPrrHhwedKCVLKRu vgC2HAe/rc7xAGiFSm8H0UquszGaiE6NIKMUO+yZB29nHZ+omlq/ptrgcOhx5ugYyiGD 9xbA== X-Gm-Message-State: ALyK8tL9onZR8trLVSN/sw1k3Ar9xvewfkK7NKeJ55Bitqw+3GXGk0m+w6Q52mcIq5zgBA== X-Received: by 10.157.53.40 with SMTP id o37mr5018566otc.79.1465163342726; Sun, 05 Jun 2016 14:49:02 -0700 (PDT) Received: from stas-air.attlocal.net (76-220-46-95.lightspeed.sntcca.sbcglobal.net. [76.220.46.95]) by smtp.gmail.com with ESMTPSA id 99sm8945147otf.36.2016.06.05.14.49.01 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 05 Jun 2016 14:49:01 -0700 (PDT) To: Rasmus Schultz References: <801c8df4-4f33-935b-5bee-ff73a0865433@gmail.com> <7fe46e6a-1195-8eda-28ec-3e225fab22a3@gmail.com> Cc: PHP internals Message-ID: Date: Sun, 5 Jun 2016 14:48:58 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] can't reflection on DateTime properties? From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > It's also impossible to write a PHP class with "internal state" - state > that I can't find at run-time with reflection. That's what makes the > language reflective. Internal state in this sense is something foreign > to PHP as well, the only exception being things like resources, but > those aren't really types in the first place, but handles to file-system > objects, representing state outside of the program. It's not foreign to PHP, it's unavailable to userspace, yes. Internal functions have access to more capabilities than userspace ones, it has always been the case in PHP. > We're talking about a simple object representing an integer timestamp > and a timezone ID. There is no logical reason those should be hidden - > it's just an implementation detail showing up as an artifact. There is a reason, or rather reasons, one of them is that internal representation of the data and user-visible one are different. What is inside the object is not what you see on the outside. > You're describing implementation details - these are features of C, not > features of the PHP language, they happen to leak into the into the PHP > language where they present themselves as inconsistencies. You can call it whatever name you like, I'm just explaining how it actually works :) Calling everything you don't understand "inconsistencies" seems to be new fashion, but the fact is internal API has more capabilities than user-space API in PHP. It is a deliberate and very old decision stemming from the fact that it is very hard - impossible, really - to give user-space access to engine features safely to PHP code. OTOH, some interesting things only possible if you have access to these features. > The fact is that DateTime does not behave like a PHP class in terms of > reflection. It behaves like internal PHP class. You can't really expose state of internal classes via reflection, since in general case this state does not have proper representation in PHP terms besides that very class itself. -- Stas Malyshev smalyshev@gmail.com