Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33266 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2966 invoked by uid 1010); 18 Nov 2007 23:14:00 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 2951 invoked from network); 18 Nov 2007 23:14:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Nov 2007 23:14:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=david.coallier@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=david.coallier@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.162.235 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: david.coallier@gmail.com X-Host-Fingerprint: 64.233.162.235 nz-out-0506.google.com Received: from [64.233.162.235] ([64.233.162.235:1052] helo=nz-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FC/B0-31009-637C0474 for ; Sun, 18 Nov 2007 18:13:59 -0500 Received: by nz-out-0506.google.com with SMTP id x7so1086297nzc for ; Sun, 18 Nov 2007 15:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=SJOUP1AF6LXT/8kI+8vfB9+Crh0bz19sFr0Nxxuthvs=; b=ZsugyrKnUT9oQFt4p09V+A6LhaM2y8Gkha7NIBZduUBpHZZkQpeJdMn9/gFfYsppvhtGPyikssRVlIlJW4Tna9Lt70MbbK1Vo19rE7HFHwyS5iyhbCzoI/dBhFkLnt2T2AL/W7hPPVZeTKi4PdA5ykT8gHMWgQxhVfcgDlCKFno= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=qUSnRrJPRWW6pbe0j/W9uSavUQPq4JC3yLCvP7hdeYmP/LSqpq6TlopARwm0lLhgN7g8QInbIx8M3XmbB72pKKVMIF6FZlaaAdg+zh1oQeBfO1QmBZ8Nd9EgIac4SSAUqolkDdv82uT37lvGWLA3AfjtvveJ+qRMYBO/obdK5kA= Received: by 10.142.147.15 with SMTP id u15mr942038wfd.1195427635459; Sun, 18 Nov 2007 15:13:55 -0800 (PST) Received: by 10.143.41.16 with HTTP; Sun, 18 Nov 2007 15:13:55 -0800 (PST) Message-ID: Date: Sun, 18 Nov 2007 18:13:55 -0500 Sender: david.coallier@gmail.com To: "Cristian Rodriguez" Cc: internals@lists.php.net In-Reply-To: <7d5a202f0711181452h3b6a26b8x5b838b585c552765@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1195140437.23612.5.camel@sbarrow-desktop> <10610581037.20071115172619@marcus-boerger.de> <7d5a202f0711181452h3b6a26b8x5b838b585c552765@mail.gmail.com> X-Google-Sender-Auth: 33938e7dcf852be1 Subject: Re: [PHP-DEV] [PATCH] Optional scalar type hinting From: davidc@php.net ("David Coallier") On Nov 18, 2007 5:52 PM, Cristian Rodriguez wrote: > 2007/11/18, Derick Rethans : > > > I am actually thinking that it might be a good thing to add more and > > more. I know my quick hack isn't the best implementation though. > > Yes and it is an alternative and not a mandatory thing to use.. as long as : > > > function foo(int $num) { > return $num > > } > > foo("12345") // emit fatal error, NOT accept it as valid integer > > all is fine and Im all for it ;) > -- > http://www.kissofjudas.net/ > I was thinking at something along the lines of objects also for instance: $i = new Integer(33); function foo(Integer $var) { } foo ($i); else it emits a fatal error. But also if you do $i = "Name"; that would emit a fatal error because the value is suposed to be an int. This might look a bit too much like java, but as an extension it could be something quite interesting I believe. String, Object, Integer, Scalar, Float and what else. So thinking of something like $string = new String("Foo"); $string = "bar" or $string->setValue("Bar"); would do $float = new Float(4.242); $float->setValue('foobar'); // That emits an error $float->setValue(3.14159); echo $float; (__toString) or echo $float->getValue; to echo it's content/value and so on. Would that be "too" java-ish to be something considered in php6 ? ;-) > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- David Coallier, Founder & Software Architect, Agora Production (http://agoraproduction.com) 51.42.06.70.18