Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97716 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71526 invoked from network); 12 Jan 2017 08:19:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jan 2017 08:19:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 104.47.32.95 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 104.47.32.95 mail-sn1nam01on0095.outbound.protection.outlook.com Received: from [104.47.32.95] ([104.47.32.95:63424] helo=NAM01-SN1-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/B1-50165-90C37785 for ; Thu, 12 Jan 2017 03:19:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=RWSoftware.onmicrosoft.com; s=selector1-zend-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=xKDVRKyryzB3LGnmtRZpDXl80aSQw/7T5ESpSF3lJkc=; b=VaoJNpR99buqydLtp/Of/2M3oLcTpJOHChKyWXgZXJjUkcEsMrlRcLSiGKObiUH51VKfvS+aT8SAvRkHiiVmaUaNZbC2qbxBf9JNhn/ea1gfUk4yDL0U2Ay3M6TcR6EznNdG9swVf1r9j/3TQGAdI/7aMSkdM6Lc3mHKMgVuNog= Received: from MWHPR02MB2477.namprd02.prod.outlook.com (10.168.204.147) by MWHPR02MB2478.namprd02.prod.outlook.com (10.168.204.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7; Thu, 12 Jan 2017 08:19:14 +0000 Received: from MWHPR02MB2477.namprd02.prod.outlook.com ([10.168.204.147]) by MWHPR02MB2477.namprd02.prod.outlook.com ([10.168.204.147]) with mapi id 15.01.0829.017; Thu, 12 Jan 2017 08:19:14 +0000 To: Andrea Faulds , "internals@lists.php.net" Thread-Topic: [PHP-DEV] Re: Change in type-hint representation Thread-Index: AQHSbAGJJH94e0ZZMkmDI5OUmOzW+6Ez30AAgACgubU= Date: Thu, 12 Jan 2017 08:19:14 +0000 Message-ID: References: ,<68.E1.30525.044B6785@pb1.pair.com> In-Reply-To: <68.E1.30525.044B6785@pb1.pair.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=dmitry@zend.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [25.173.117.4] x-ms-office365-filtering-correlation-id: c8f6fbd6-50b1-42e3-591e-08d43ac3b1f6 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR02MB2478; x-microsoft-exchange-diagnostics: 1;MWHPR02MB2478;7:74MSP6I+vLYbm3fGz6TJmxYYnOAfZwqw/+fY09duWva82qQTgwYaHvrgmJzvPLFPJXKXvE8XDnfmA7gEHrmA5/aXmHk3A+8bqpSVkcrFYHHfhKHt69TUcKZnFG40bX1o71aaZFhRfeckSyHg5B/Dn4Zq9jR+NynX1fYrDmjNrkIo3Pb9hE/kiImByp5W9kol+PdoKVM7pu5BgpqcM8Ic6k+srz2eP/dmX3hBfHXkyHoFR8SHcEMsSLqtBg2+Rf6BRDPcTBBUMfnUrxcF0+MZKw4DNYuREmeZq+D+uPPbC9gQe8PDc/yWiP5ma/iqkDvnRONvKFLl7yQ4hIYFpgwae6zf99U698Pw9tkiT823YrqeNoUjP5R0XaWnc1uaEkohsOzVxX6PWQire39flWUI5ESmtWb6pcmQj5Q0jMsGBRB74TjoMxiid8FKm32k+1ORMB7wDyrap9QF+pNxRH3JDw== x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(158342451672863)(23657631684272)(166708455590820)(192278398808882); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123555025)(20161123562025)(20161123560025)(20161123564025)(6072148);SRVR:MWHPR02MB2478;BCL:0;PCL:0;RULEID:;SRVR:MWHPR02MB2478; x-forefront-prvs: 018577E36E x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(7916002)(39450400003)(377454003)(189002)(24454002)(199003)(66066001)(54896002)(6436002)(606005)(8936002)(2906002)(6506006)(7696004)(6306002)(2950100002)(105586002)(25786008)(92566002)(2900100001)(189998001)(54356999)(81156014)(122556002)(77096006)(76176999)(2501003)(107886002)(3660700001)(97736004)(8676002)(81166006)(38730400001)(99286003)(16799955002)(15188155005)(5660300001)(50986999)(55016002)(3846002)(74316002)(575784001)(9686003)(68736007)(3280700002)(102836003)(101416001)(106356001)(106116001)(86362001)(7736002)(33656002)(229853002)(7906003)(6116002)(236005)(5001770100001)(561944003)(556834004);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR02MB2478;H:MWHPR02MB2477.namprd02.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: zend.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/alternative; boundary="_000_MWHPR02MB2477B78F800647065A361C36BF790MWHPR02MB2477namp_" MIME-Version: 1.0 X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jan 2017 08:19:14.3547 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 32210298-c08b-4829-8097-6b12c025a892 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB2478 Subject: Re: [PHP-DEV] Re: Change in type-hint representation From: dmitry@zend.com (Dmitry Stogov) --_000_MWHPR02MB2477B78F800647065A361C36BF790MWHPR02MB2477namp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi Andrea, 1) ZEND_TYPE_CE() is not used yet. We may make distinct between zend_string= * and zend_class_entry* based on context or using a value of reserved bit (= 0x2). 2) We can't initialize zend_strings* in constant structures, so we store co= nst char*. This code converts that const char* into zend_string*. Thanks. Dmitry. ________________________________ From: Andrea Faulds Sent: Thursday, January 12, 2017 1:39:56 AM To: internals@lists.php.net Subject: [PHP-DEV] Re: Change in type-hint representation Hey Dmitry, Dmitry Stogov wrote: > 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 I like this proposal, particularly how it's more compact than our existing representation. One comment: it appears that these zend_type values can encode both pointers to strings (class names) and pointers to class entries, right? How do you know whether a given zend_type value is one or the other? Should you just know from context? (It looks like ZEND_TYPE_CE() is in fact unused right now=85) On a related note, look at this portion of the diff: + if (ZEND_TYPE_IS_SET(info->type)) { + if (ZEND_TYPE_IS_CLASS(info->type)) { + const char *type_name =3D (const ch= ar*)info->type; Is this a type confusion between zend_string* and const char*? Thanks! -- Andrea Faulds https://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php --_000_MWHPR02MB2477B78F800647065A361C36BF790MWHPR02MB2477namp_--