Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97693 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5215 invoked from network); 11 Jan 2017 17:25:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jan 2017 17:25:00 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.66 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.215.66 mail-lf0-f66.google.com Received: from [209.85.215.66] ([209.85.215.66:36195] helo=mail-lf0-f66.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/33-55699-96A66785 for ; Wed, 11 Jan 2017 12:24:57 -0500 Received: by mail-lf0-f66.google.com with SMTP id h65so1489476lfi.3 for ; Wed, 11 Jan 2017 09:24:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=DuP+nuekOgNV+1cH/V1/I1z+uxCgTsXqZQZvw6tRL+s=; b=aSYJycK/7OuUvMpdv367gcxI56ely8cUZEZ4H8NBnOGmuIA44HZMjGjEaQUzR8sx/1 SlE2BBAL1A0EU4ZDO+D/VkMx14Ay9UPCN6se/SlaQegS2VBYLEpu7nNnmy0CUyNy5I67 0Z+2fAhEqvpeF+LDiMCQtmJvsO3ntL7VvBGQVZxY9tpLb1SMIXx5P4OgVh0AREded/qz qu9pZ34NpROCljevuVpNrOBJUB3lQ5mw7vSCxJDxqnvyWp5SWWsskLG629cOgkKj4oNN XOoFCsVdPtsOiby7ShyFTuJx4x8L0pZMFqDdH3d2tfOk5ov4stNAIpwtBajBWS1sMHOf hfXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=DuP+nuekOgNV+1cH/V1/I1z+uxCgTsXqZQZvw6tRL+s=; b=fJcRDHMb/RptKkYDbpc8mpID5sLiQwy56loLT5hAS00NrW9pTBvpDN30+fZfDPaZ30 +ZLwWp7popxIALYx7YLwMD3Usgja8SmjDPw+GA5I12mji6Glv5SyFn38s9v5seprqKfK 5nMDcqjoZtiHE3tJSH4yTDei6Wzgs4ohhMgTvk1ScKHK5+peNNjPUkEMeZcOUN4int2O RDdGbfkDs4F9J3PobgkWwQme7w0TM2hJ3ND0A0uGWAApxnN+6+xErdrFlp15bZ9TmQP6 148WaqDRfkH/uxLvYQAXwuO5fMYouAm0IRujsEiRKRWyBu7RXBoCjiB6xebHl5c6XojA fAEQ== X-Gm-Message-State: AIkVDXL/Aa+5Sddt5joKCgS/fwXPC5jrGJqCaI/7iedOufeBOFJ2rETImjFr1FmDL0B8gEbwLtuU7wCGMA5nxw== X-Received: by 10.46.21.25 with SMTP id s25mr3493156ljd.54.1484155494480; Wed, 11 Jan 2017 09:24:54 -0800 (PST) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.25.151.139 with HTTP; Wed, 11 Jan 2017 09:24:53 -0800 (PST) In-Reply-To: References: Date: Wed, 11 Jan 2017 10:24:53 -0700 X-Google-Sender-Auth: o1rSyk1O1XMBtesi2Tal06JCOf0 Message-ID: To: Dmitry Stogov Cc: Derick Rethans , PHP internals list , Bob Weinand , Joe Watkins , Zeev Suraski , "Anatol Belski (ab@php.net)" , Nikita Popov , Xinchen Hui Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Change in type-hint representation From: levim@php.net (Levi Morrison) On Wed, Jan 11, 2017 at 9:37 AM, Dmitry Stogov wrote: > The patch was updated according to feedback: added comments, better names and encapsulation, less magic, better code reuse, keep a free bit in zend_type for future extension. > > > > > > https://gist.github.com/dstogov/1b25079856afccf0d69f77d499cb0ab1 > > > Thanks. Dmitry. > > > > ________________________________ > From: Derick Rethans > Sent: Wednesday, January 11, 2017 6:43:50 PM > To: Dmitry Stogov > Cc: PHP internals list; Bob Weinand; Joe Watkins; Zeev Suraski; Anatol Belski (ab@php.net); Nikita Popov; Xinchen Hui > Subject: Re: [PHP-DEV] Change in type-hint representation > > On Wed, 11 Jan 2017, Dmitry Stogov wrote: > >> Hi, >> >> >> I propose to introduce a unified type representation (zend_type). >> >> Now it's going to be used for typing of arguments and return values. >> >> Later we should use it for properties and other things. >> >> >> https://gist.github.com/dstogov/1b25079856afccf0d69f77d499cb0ab1 >> >> >> The main changes are in zend_types.h and zend_compile.h, the rest is just an adoption for new type representation. >> >> I don't think we need RFC, because this is just an internal change that doesn't change behavior. >> >> >> I got the idea working on typed properties together with Bob and Joe. >> >> https://github.com/php/php-src/compare/master...bwoebi:typed_ref_properties >> >> I think it would be better to introduce zend_type and then continue work on typed properties. >> >> >> Any comments? > > 208 + if (new_arg_info[i].type > 0x3ff) { > > I wouldn't use a magical constant there, but do a define of what 0x3ff > actually is. > > 209 + /* this is a calss name */ > > That's spelled "class" (not "calss"). > > cheers, > Derick As part of this effort can we refactor the IS_LONG, IS_ARRAY, IS_OBJECT, etc macros to use an enum? Maybe `zend_type_code` if you like the `code` name for it? Also we already use "kind" in the AST; should it be `ZEND_TYPE_KIND` and `zend_type_kind` instead? Overall I think this cleanup is needed. Thanks, Dmitry.