Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58986 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39674 invoked from network); 17 Mar 2012 19:03:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2012 19:03:45 -0000 Authentication-Results: pb1.pair.com header.from=adamjonr@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=adamjonr@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.170 as permitted sender) X-PHP-List-Original-Sender: adamjonr@gmail.com X-Host-Fingerprint: 209.85.210.170 mail-iy0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:65453] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/61-43639-010E46F4 for ; Sat, 17 Mar 2012 14:03:44 -0500 Received: by iaeh11 with SMTP id h11so8572204iae.29 for ; Sat, 17 Mar 2012 12:03:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=zIaklwyC+UjsouA9Dbvanu9LZu1t5uIB0auXCpntB+Y=; b=QbmIlp4ln8ytcnoYtNATfCBNmDY815Be7GDrA7P/2nz6lbEXeJSEzg5YaSmyH0irHr fvMxPACGyavdmR9elT/wlIzWv9OJGQWSf4stoskXITPN/IcLr36w8UbzUVxAU7q+JvPX BGMk3eu82HBVi9y9lv7kyN85WSX72uATI9mDAqUMTS8L5ePm4niAXaKnVsN26dlrx3W8 BiwzV7+c05//x1+vhAySybsSWyhUT86XFVB2GSSl5scMMkC7gxQOocbg7L6QPp++q+U7 Fr0vrAdQNOVB/oi07kHac5RsN+YJ45+UBgX7ebPHHmf5ON7/GaTdRGDWP0NUCRjaocDo +3jw== MIME-Version: 1.0 Received: by 10.182.225.69 with SMTP id ri5mr7071145obc.74.1332011021804; Sat, 17 Mar 2012 12:03:41 -0700 (PDT) Received: by 10.182.19.104 with HTTP; Sat, 17 Mar 2012 12:03:41 -0700 (PDT) In-Reply-To: References: Date: Sat, 17 Mar 2012 15:03:41 -0400 Message-ID: To: PHP Internals List Content-Type: multipart/alternative; boundary=f46d04479713caa5f204bb74fb9c Subject: Re: [PHP-DEV] Scalar-type-hinting - which way is the best to go? From: adamjonr@gmail.com (Adam Jon Richardson) --f46d04479713caa5f204bb74fb9c Content-Type: text/plain; charset=ISO-8859-1 On Sat, Mar 17, 2012 at 10:37 AM, Marco Pivetta wrote: > Unenforced type hinting: > - If you have mixed types, then you just don't need type hinting. Lazy > devs can still avoid using it. Lazyness shouldn't really be > encouraged, so > providing some kind of "backwards compatibility" just makes the > feature > useless :\ > - This is not a feature, it's just better implicit documentation for > methods > I just want to quick point out that I suggested the idea of introducing a scalar type hint that would accept all scalars but would disallow passing in arrays or objects. Additionally, the proposal outlined the option of introducing aliases for the scalar hint (bool, int, float, string) which would help developers better declare their intentions in terms of how they expected to use the scalar type. I don't think Nikita was referring to my idea when he referenced "unenforced type hinting", as his examples show that passing in an object or array would both succeed even with an int (scalar) type hint. That said, I couldn't find a proposal suggesting a type hinting proposal that was purely documentational, so I wanted to take the time to make sure there was no miscommunication. Adam --f46d04479713caa5f204bb74fb9c--