Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44581 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96467 invoked from network); 1 Jul 2009 17:24:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jul 2009 17:24:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=paul.biggar@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=paul.biggar@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.227 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: paul.biggar@gmail.com X-Host-Fingerprint: 209.85.219.227 mail-ew0-f227.google.com Received: from [209.85.219.227] ([209.85.219.227:47482] helo=mail-ew0-f227.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/51-24906-2CB9B4A4 for ; Wed, 01 Jul 2009 13:24:18 -0400 Received: by ewy27 with SMTP id 27so1162445ewy.23 for ; Wed, 01 Jul 2009 10:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=u8bnxfso8CZZZow+BGB+lHiFX9ivwrqKSWQ1igrbVyQ=; b=Do0estuGDi9NugrjfoV9/nfehvJgDOyCqy3x38FKRgDTnnHOQKXAFfhtqW3nK4pbyR 3ke8wdn98oWb71VhWzzYlqljRosIyGTgu5bP8IsfJ+3kYmcPbgKGKN7//UK+2X5yaztV dUVhrxoMKia44yeWJdImqyN0MTavmGdub3biI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=Ck0weK+bip9xnY4fNo4nLhv9sIfIQ27Jpse/hRKn4n1ktDsnmQpS10M6pJfPcpGnxM M4QkA/0Gny2tgGIOU4VmoA0bDnK9mJBxJ9SqYzRk5R1Lah/hxI5O43mY6hJn3kzG05Uv grNPRW11VENgZt3VaoDSZL7WMR2JnDCRAKZR0= MIME-Version: 1.0 Received: by 10.210.105.3 with SMTP id d3mr6913758ebc.28.1246469055142; Wed, 01 Jul 2009 10:24:15 -0700 (PDT) In-Reply-To: References: Date: Wed, 1 Jul 2009 18:23:55 +0100 Message-ID: To: Ilia Alshanetsky Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC: Type hinting revisited for PHP 5.3 From: paul.biggar@gmail.com (Paul Biggar) Hi Ilia, This is great. On Wed, Jul 1, 2009 at 5:59 PM, Ilia Alshanetsky wrote: > I've taken a few hours this morning to port my 5.2 type hinting patch to > 5.3. In recognition of a need for a more 'flexible' numeric type I've > introduced (numeric) type hint that would allow bool/int/float data types as > well as a string containing a numeric entity as identified by > is_numeric_string(). For completion i've also added (scalar) data type that > will allow any scalar data element. I think this will go a long way to addressing people's concerns when this came up previously. > The patch is available here: http://ia.gd/patch/type_hint_53.txt I presume the idea is that some people (if they so chose) would want to type hint every parameter in their program. To facilitate this, I might suggest a "mixed" hint (like in the docs), and a null hint (though I'm not sure if it would be called "null" or "unset" or both). Finally, I don't want to ruin this, but last time there was disagreement over whether numbers should be coerced to the specified types, or left alone. What does your patch do? ie function x (int $x) { echo is_int ($x); } x ("5"); Thanks, Paul > It should be noted that this is not the first idea for type hints, that > credit goes to Hannes Magnusson who had posted a similar patch on the > internals list back in 2006. Also, back in 2008 Felipe Pena wrote a type > hinting patch for PHP that is available on wiki.php.net. > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Paul Biggar paul.biggar@gmail.com