Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86164 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75726 invoked from network); 12 May 2015 05:19:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2015 05:19:27 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.180 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.180 mail-pd0-f180.google.com Received: from [209.85.192.180] ([209.85.192.180:35084] helo=mail-pd0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7A/80-04700-E5D81555 for ; Tue, 12 May 2015 01:19:27 -0400 Received: by pdbqd1 with SMTP id qd1so168617904pdb.2 for ; Mon, 11 May 2015 22:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=JDL60VvNW36EBOov1j1Y9/1O9kuY8TfUSU+JEx3gYog=; b=atFpF4p52VE4TU9tzAmcQBGDvAzZdG+Vn8vUbhom4zScI0/WFy7EKxXYw8tKdI7tIp ZIfV+mV60Yl2Gt4a1UH7oMUUIkfv0YQzpTs9EFSB+0mAtUiD2I2B0sRQRTzY526ljBFJ Jo2WFOYapQis/TTLmggtZ53Kdv7d5pdh2WeyPN2xzzmlSw9p5pzlDovF6QQjmy1vJYAp iC8Vw8zvn6ubTg65XC9bRyZoZ/0hJ3fmNUrQr1Gsmspho+Tu9XP8gr6kW7NuNkrROU4z iX/9a/JS6kl//AggpVYOmK4eP1tBBXigpejmNO/Qv1pnixdsBe64n2V35zvmrH9Pnqsr PMtA== X-Received: by 10.66.138.15 with SMTP id qm15mr25020541pab.52.1431407963702; Mon, 11 May 2015 22:19:23 -0700 (PDT) Received: from Stas-Air.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id za1sm11703457pbb.55.2015.05.11.22.19.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 22:19:23 -0700 (PDT) Message-ID: <55518D59.6070108@gmail.com> Date: Mon, 11 May 2015 22:19:21 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Yasuo Ohgaki , "internals@lists.php.net" References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] is_digits() and digits type From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > - is_digits() and digits type for digits only inputs(integer like string) > - is_numeric() and numeric type for float like string This is not what types are in PHP, and not what they should be, IMO. If you want to assign arbitrary checks to a variable, I would suggest using a class with a suitable constructor. If you think it's too slow (meaning you are doing very heavy in-memory data processing and nothing else), make an extension - it would be roughly the same speed as native PHP types. If you want it to be extensible - then you may be looking for something like pre/post conditions and DbC, but this is another story for which we need proper RFCs, etc. However, calling random combination of native types, objects and string constraints "type" because somewhere there's use case for it does not look like a good design for a language. It's too random and ad-hoc. -- Stas Malyshev smalyshev@gmail.com