Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86032 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20956 invoked from network); 29 Apr 2015 21:28:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Apr 2015 21:28:42 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.51 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.218.51 mail-oi0-f51.google.com Received: from [209.85.218.51] ([209.85.218.51:35121] helo=mail-oi0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/C3-26317-90D41455 for ; Wed, 29 Apr 2015 17:28:42 -0400 Received: by oign205 with SMTP id n205so32894160oig.2 for ; Wed, 29 Apr 2015 14:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=e7RO1AvHMGO/bXOkUVy7OxR3WnsGkCsOajZU9X1fRmY=; b=qaurdd3DkpfLf3Hw5T53Oc2GktN+lu9JWv9hB0jukYG/PbKx7oZ6/z8eiifmk+EAgz KIC8wSQ2FZ5AZcAeeNpItl+VLQ/FWUzBxjikFDThamdc+tceZmYKnT644zlO9VoaV0if 5j1Dqsh2cJN3bLOC5XDuBAY25AkZFrcOJPdbmRKCn3Nf7jGY5pU7VEigRzHjgIhQ51Xz Z7Ooq3QInYgjUqspazb0+sNEQ08cUggUzCAAwUsqHmAXZpSaW+KX4LbGkEs2W+rS0VtN wESbCUwIyM7q5GYL5uBlFZMcmHwYev7G8wMzbJ8sNusXDTak7BeeNAtC3nBeduiP8sAd Jihg== X-Received: by 10.182.28.34 with SMTP id y2mr908734obg.15.1430342919464; Wed, 29 Apr 2015 14:28:39 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.202.104.196 with HTTP; Wed, 29 Apr 2015 14:27:59 -0700 (PDT) In-Reply-To: References: <00a501d08263$cda30310$68e90930$@php.net> Date: Thu, 30 Apr 2015 06:27:59 +0900 X-Google-Sender-Auth: sT0DIpG1oUfcL1D7Vt5c1D0o3Tk Message-ID: To: francois Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e0158ae889f2cda0514e3a916 Subject: Re: [PHP-DEV] Adding "numeric" type hint From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e0158ae889f2cda0514e3a916 Content-Type: text/plain; charset=UTF-8 Hi Francois, On Thu, Apr 30, 2015 at 6:23 AM, Yasuo Ohgaki wrote: > Allowing any forms of int/float as string(and GMP) for weak mode int/float > type hint > would be alternative resolution for this issue. I think it's better than > "numeric" type > hint. > > It seems current weak/strict type hint difference is > - weak: allow conversion, force the type > - strict: not allow conversion, force the type > > If weak mode allows this > > function foo(int $val) { > // $val became "int" if value fits for int > // otherwise "integer string" or "gmp" object accepted > // anything else is error > } > I forgot to mention float. 32 bit machines uses float as int extensively. So it should be function foo(int $val) { // $val became "int" if value fits for int // (allow float value that is integer form) // otherwise "integer string" or "gmp" object accepted // anything else is error } Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --089e0158ae889f2cda0514e3a916--