Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97708 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39287 invoked from network); 11 Jan 2017 22:39:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jan 2017 22:39:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.51 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.215.51 mail-lf0-f51.google.com Received: from [209.85.215.51] ([209.85.215.51:33878] helo=mail-lf0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 75/91-30525-304B6785 for ; Wed, 11 Jan 2017 17:39:00 -0500 Received: by mail-lf0-f51.google.com with SMTP id v186so1405455lfa.1 for ; Wed, 11 Jan 2017 14:38:59 -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=t7R3mNLjxp/0ndgh59nOWyyxYPVJBvcDabud86nGlPs=; b=VVXfNGVmP0suHg3EQS6q9D5YjqcjZaiq/rwQb51HwHjnAkrm9FvEbtKxIrXbalDC03 bNLoB8uK9fP5Ycm6Gsarcu9i2tin7Mh8ecD7obzAcyIh4Na6vBo1mPesVj9iSHxDGIUS QTFjDTzvVhze5WyEHSHGAKHtULcDfP3zUgbVZlaKeupIl/UV3hnWB4H4plYaAyHp7RV5 BQGtEH8yfsMkkDA0yLpqlCr8MlDqEEJphyIWbz9Y5Lw8Wx/Jxzk9JV/ZzYXkY2Jj+Uog LteijZEw3X2U1j1kG0V1oSHo+YvZPjrj1/AzxqQzuSpGw/D4JSfAFPVL8+8QnABPnIQW Si7g== 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=t7R3mNLjxp/0ndgh59nOWyyxYPVJBvcDabud86nGlPs=; b=oyX7mdOwpOO8zRahjOt0Jei1oTKCNAAtakzO6LD+lqEOpaYC3mxW/mmlrCQkeaI4Ay lRlSlafwInYoMeq9/PWtZLU8VdjZfoUJqDRs2dFSW57O0maSu48wGaIL4UhMCdgFAzsp dgNCmsI0zbHhiaP2m5raHYBt5THZIt2O3Oyq5g+rS0W9O/qXyT3LsWkd1JTCRtWuCi3Y EBsSW0/bTH5vs4wnrczASrvG4UMhl4zR9JrQ5R/yYfp+kimHCE18Uox9SfWO7ixvGX+N ME6yzzitp9KWMAVTCkqpVFjmZHFpFrEpJnJs002ckWH1xuP2LyD4Eak3vwju9Hmph1f0 CpMQ== X-Gm-Message-State: AIkVDXJbJ9tepvpSyH/z3uhjrgGsp5S5fWnUvmgPH5wAM3TaXRI1URJlU/+MwvGz1taiw4fTQNSd5x2/MPxouQ== X-Received: by 10.46.20.73 with SMTP id 9mr4231697lju.10.1484174335941; Wed, 11 Jan 2017 14:38:55 -0800 (PST) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.25.151.139 with HTTP; Wed, 11 Jan 2017 14:38:55 -0800 (PST) In-Reply-To: <1C.D0.30525.402B6785@pb1.pair.com> References: <1C.D0.30525.402B6785@pb1.pair.com> Date: Wed, 11 Jan 2017 15:38:55 -0700 X-Google-Sender-Auth: T8LVSH0rPQhbG0iS3I9B7CyyE_0 Message-ID: To: Andrea Faulds Cc: internals 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 3:30 PM, Andrea Faulds wrote: > Hi Levi, > > Levi Morrison wrote: >> >> 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? > > > C's enum members always have the type `int`. However, typically PHP uses the > smaller `zend_uchar` for representing a type code. I guess this is why we > don't use an enum already. This is not true; rather they are only required to support values that can be held in `int`. Implementations are free to compact it. However it is an issue I had forgotten about, and it is certainly something to keep in mind. > Having a typedef of zend_uchar for this purpose would be great, though. It > would make some function signatures more obvious (e.g. is_numeric_string and > friends return a zend_uchar for the type of the result, and it'd be clearer > this is the case). Yes, at least *something* would be nice if `enum` is problematic.