Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97682 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82151 invoked from network); 11 Jan 2017 14:11:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jan 2017 14:11:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.210.181 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.210.181 mail-wj0-f181.google.com Received: from [209.85.210.181] ([209.85.210.181:33012] helo=mail-wj0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CE/2F-55699-AFC36785 for ; Wed, 11 Jan 2017 09:11:09 -0500 Received: by mail-wj0-f181.google.com with SMTP id kq3so57359936wjc.0 for ; Wed, 11 Jan 2017 06:11:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pthreads-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HRG3HOKIrtbuPK8SCK/UlXFFlw3aMg7KP/3AgkIJFug=; b=Kj7On9Yq/HKSUb0Msv161uHr1w5mUZNJPpysbCMXxUeGNHHuMV3eTbjA7P1dWk7hUT usOOmRmMqGgZHL2k5jrW3BZbG/eLgjBUR3HSC6cEzvJSSETXijWKPxdZQ7WYIvrdTL+U VA4mAIG105FcFVO1yxBhPdZPAZgdyXGsNtuOmU601BJEywu50DwKOjKYDTpR8SCcBZ0S fHYiUXqhJ1xZCkLxdTs+Du7R018y2p65hg+GPrJMt6WU6WwnW5GUep1HrsLvAJYBcwV6 oSTsssSwU3+XOqFBJag/6QEfsatnHB3nwmrBjr3kfNYXIhqrTyKuMtBk6UPUAdv6EhRG GXRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=HRG3HOKIrtbuPK8SCK/UlXFFlw3aMg7KP/3AgkIJFug=; b=nkPMnciO1dPmzap8CQG9Nvuffd+Et0pUza00iKFVJZyyo8GQfgmqNts+o1aNWZwP5m 4kSCb3uce1O7yz5hdQtTjYPWo3luSqIXSK5/SNnaOcNx4wu4sysCVNLawEtTv0my2c1+ qlrK9sL6J5JKvQTPfR65vtpMP3LAmDlRig1funC+bHnpt0uGHewCi3cxc1hfBN4cFIJN 1+74A7ZHFnDOhXx195DxQqKHzHkalUsfARDdUh5NfcjW+/cx61w8qEwGMLIIQnu0FqTG sLhvrIxKTCnotbWqd8ZbWUwRcwf+BOBKcXbjiY9fkOz4y7VfqEiFGOh+i+I3qxGDSOPo v6Ag== X-Gm-Message-State: AIkVDXJQk8Hr1QOG7LfQdsKfgmHwkgS7bNyz7ri0qJ9JoEjrZQGpXHhoJ6j5fhovyUlqM+Zi4p1RWdNnGeRNDg== X-Received: by 10.195.30.43 with SMTP id kb11mr5234991wjd.131.1484143863946; Wed, 11 Jan 2017 06:11:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.176.4 with HTTP; Wed, 11 Jan 2017 06:11:03 -0800 (PST) X-Originating-IP: [86.178.168.203] In-Reply-To: References: Date: Wed, 11 Jan 2017 14:11:03 +0000 Message-ID: To: Niklas Keller Cc: =?UTF-8?Q?Micha=C5=82_Brzuchalski?= , Nikita Nefedov , Dmitry Stogov , PHP Internals Content-Type: multipart/alternative; boundary=001a11368ff8ce7d700545d22b4c Subject: Re: [PHP-DEV] Change in type-hint representation From: pthreads@pthreads.org (Joe Watkins) --001a11368ff8ce7d700545d22b4c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Morning Dmitry, I know bob has already requested some additions ... nothing to really say about it ... I just wanted to chime in with VERY NICE :D (shouting intentional) ... Oh and, I think an RFC is pretty pointless ... */me looks forward to master having this* Cheers Joe On Wed, Jan 11, 2017 at 2:00 PM, Niklas Keller wrote: > Micha=C5=82 Brzuchalski schrieb am Mi., 11. Jan.= 2017, > 14:51: > > > 2017-01-11 14:35 GMT+01:00 Nikita Nefedov : > > > > > On Wed, 11 Jan 2017 15:07:39 +0300, 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? > > >> > > >> > > >> Thanks. Dmitry. > > >> > > >> > > >> > > > Hey Dmitry, > > > > > > Having worked on callable prototypes I'd say unifying PHP types in Ze= nd > > > is something we urgently need for PHP to continue evolving. > > > > > > I'm not sure if PHP have ever been compatible with less-than-32bit > > > archs but if it was I think it should be said that this would break > > > such compatibility though. > > > > > > It would be great if there were some comment in the code near zend_ty= pe > > > declaration where you'd explain how it is used and how additional > > > data is being added to the pointer. > > > > > > Is there any use of ZEND_TYPE_CE() macro? It seems to be forgotten > there? > > > > > > If I understood this correctly, the layout of zend_type is as follows= : > > > > > > [xxxx xxxx xxxx xxxx] xxxx xxxx xxxx xxy0 - for IS_OBJECT type hint > > > where the `xxxx`s are a (zend_string *) pointer and `y` designate= s > > > an allow_null flag > > > > > > > > I've got prepared Object Typehint RFC > > https://wiki.php.net/rfc/object-typehint where > > IS_OBJECT is used without class name as type hint for any object kind, = if > > this patch > > would be applied how can I deal with this new zend_type? > > As far as I undestand last 0 for IS_OBJECT and no (zend_string *) point= er > > would give me > > empty zend_string value right? So that won't bive me any chances to sto= re > > IS_OBJECT > > without classname am I right? > > > > Morning. > > As far as I understand it, 0 just means no built in type. As long as no > class name is there, it's just no type at all. > > Regards, Niklas > > > > [xxxx xxxx xxxx xxxx] xxxx xxxx xxxx xxy1 - for all other type hints > > > where the `xxxx`s are a IS_CALLABLE, _IS_BOOL, IS_LONG, IS_DOUBLE= , > > > IS_STRING or IS_ARRAY > > > > > > Do we decide here that IS_REF modifier should belong to the concrete > > > usages of the type (e.g. referentiality is a property of a variable > > > and not of a type)? > > > I'm not sure this if is a right decision or not but I feel like this > > > question should be raised. It is usually the opposite in other > languages. > > > > > > How would you plan to extend this further? Let's say at some point we > > > will have callable prototypes or generic classes: we will need to > encode > > > somehow this type into zend_type: `callable(A)` or `A`. > > > Even right now it might be useful (as you suggest with ZEND_TYPE_CE) > > > to store a (zend_class_entry *) instead of (zend_string *) when > > > it is known to us in the zend_type. > > > Seems like without extending zend_type to the size of two pointers > > > it almost isn't doable :\ > > > Or, it could be made that zend_type, when it's not a simple type hint= , > > > would point to the `zend_type_complex` which would store a > > > zend_class_entry pointer (or not, if it's for callable) and an array > > > of type specifiers. But that introduces another indirection. > > > > > > Anyway thanks for polishing this part, we definitely need zend_type i= n > > > some form. > > > > > > -- > > > PHP Internals - PHP Runtime Development Mailing List > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > -- > > regards / pozdrawiam, > > -- > > Micha=C5=82 Brzuchalski > > about.me/brzuchal > > brzuchalski.com > > > --001a11368ff8ce7d700545d22b4c--