Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80029 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62620 invoked from network); 31 Dec 2014 20:52:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Dec 2014 20:52:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.223.181 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.223.181 mail-ie0-f181.google.com Received: from [209.85.223.181] ([209.85.223.181:50216] helo=mail-ie0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 52/30-60454-FF164A45 for ; Wed, 31 Dec 2014 15:52:16 -0500 Received: by mail-ie0-f181.google.com with SMTP id rl12so13445726iec.12 for ; Wed, 31 Dec 2014 12:52:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=J8ng1dXmwDG9mUjeXfa3Sigh0bz76pGDZQ0ev6I4k/I=; b=OA6YsyAeUJO01AepoQYepAPf6lCv8E+g5m9Id5Sv8bp0XrmW9MI4Io8jb5FAJUgku9 QZbJsXz5t99M/nwvkUCvE2l42qkfhGmUg9RcUi/Sr+p8+7u7Y0bXQe08BVmvhhw147YE p4+qTRFDC0AywEpj56nKc+MZfOYe4yH5O57mM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=J8ng1dXmwDG9mUjeXfa3Sigh0bz76pGDZQ0ev6I4k/I=; b=CjdG1kZQZ76x+g+Lgn8LWP6/oEEjupoRRK7OAhb+FinGgrJrfFNoX9MdYeTLO75m5K c+UA+ZPzcZ6qhJuYLwejk80ph54Ako+/WFoObtqkuiBz/p6t7B2jTnYCh5fPUMwKm8nI xeuIIoysO2jRoZ9/QdUpZDQ5++M0kuJbAhcbmVgxGG+kS6yNWGhMBum5OkoC0Qf8+5OM I814tNyh5jYWLUQFmu6YnxQsuFB3km/4D63C7LIPgSpfDhcmCfT56FYZ0gAPD+gxTn5A KAVy1OKpHWFE2Sp5KuloKowaW7JNVwKp+sWEuVS89NdWSwDDxQApKoiFX8sIz12KFVbG M/2w== X-Gm-Message-State: ALoCoQmF8j087Omdoy60vlWDD1GJoJFNRFbyZbZiGqAyOH7yNlI1S4gIbntLJNQisXrUzEyvulro X-Received: by 10.107.12.10 with SMTP id w10mr62057153ioi.71.1420059132427; Wed, 31 Dec 2014 12:52:12 -0800 (PST) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.43.112.9 with HTTP; Wed, 31 Dec 2014 12:51:52 -0800 (PST) In-Reply-To: <41D5BB0B-73AF-488E-968D-90B2878E3178@ajf.me> References: <41D5BB0B-73AF-488E-968D-90B2878E3178@ajf.me> Date: Wed, 31 Dec 2014 12:51:52 -0800 X-Google-Sender-Auth: k1ppT-L7VdZr7LrHukbX3X-mOtU Message-ID: To: Andrea Faulds Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints From: aharvey@php.net (Adam Harvey) On 31 December 2014 at 12:27, Andrea Faulds wrote: > Parameter type hints for PHP=E2=80=99s scalar types are a long-requested = feature for PHP. Today I am proposing an RFC which is a new attempt to add = them to the language. It is my hope that we can finally get this done for P= HP 7. > > I=E2=80=99d like to thank Dmitry, who emailed me and gave me some feedbac= k on the draft RFC and some improvements to the patch. He encouraged me to = put this to internals sooner rather than later, as it=E2=80=99s a feature m= any people are hoping will be in PHP 7. > > The new RFC can be found here: https://wiki.php.net/rfc/scalar_type_hints At a first read through, this looks great, and much more in line with what I'd like scalar type hints to look like. Nice job! In terms of the open issues, here's what I think: 1. Aliases: I think we should support the same set of names as we currently support for type casts[0] (excluding non-scalar types, obviously) =E2=80=94 this actually expands the list a little more, since th= ere are three (!) variants for floating point values, but I think it's important to be consistent in all the places in the language where we use "type" names. 2. Prohibiting use in class names: I think this makes sense, otherwise we'll be violating the principle of least surprise when somebody does call a class Int. (Yes, namespacing might help here, but I think I'd rather restrict it altogether rather than trying to come up with rules around when you can call a class "int" and how you'd refer to it.) To bang another drum (and this shouldn't be responded to in this thread, since we have another one going for this RFC): this sort of change is why 5.7 is vital for migration =E2=80=94 emitting deprecation warnings for users calling classes by names that we'll be prohibiting in PHP 7 is important, and will help our users migrate their code bases. I haven't looked at the patches yet, but assuming they're good, my initial feeling is +1. Good work on taming the beast. :) Adam [0] http://php.net/manual/en/language.types.type-juggling.php#language.type= s.typecasting