Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37129 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3615 invoked from network); 18 Apr 2008 08:03:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2008 08:03:50 -0000 Authentication-Results: pb1.pair.com header.from=paul.biggar@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=paul.biggar@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.146.176 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.146.176 wa-out-1112.google.com Received: from [209.85.146.176] ([209.85.146.176:38272] helo=wa-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/D7-54733-2E558084 for ; Fri, 18 Apr 2008 04:03:50 -0400 Received: by wa-out-1112.google.com with SMTP id l24so633168waf.17 for ; Fri, 18 Apr 2008 01:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=ayjgbxGcEeIKZdQ2VY3ZUN+QNwCroefqH4pVzoWJ9pE=; b=rai6h8hHduZu0tefxlwKCGEgbUY9nHbCn7JJHPmOwAmBZmV84IA+CHYYzAXiid7vI+ZoxTVYa3MDhnu1mz6nXG/RqCHM8FKSrKmgAUYtvShvlFtOGG3HwRXmfDXEENunu0PYr0/ms+WiRA1Bo3bT3rnM8t8//ArxOoviO90GQIU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ZgyUqJNXX9gJQZHCUv7CkN4ac4JwH4wvyJedWACKg4zcyb5XmWMEW8WIDEcd6vQmlIL0Fn0weez2oBV/QQAZf52NyRGUUP2BWF0BiVlRcd/uZ4n5i8d5s3CkeYSIUpsGaRihao1NoageUt9LMOBLyUBQ/7GIaHUyGxFedDNpw0I= Received: by 10.114.110.12 with SMTP id i12mr2263074wac.73.1208505821730; Fri, 18 Apr 2008 01:03:41 -0700 (PDT) Received: by 10.114.255.17 with HTTP; Fri, 18 Apr 2008 01:03:41 -0700 (PDT) Message-ID: Date: Fri, 18 Apr 2008 10:03:41 +0200 To: "Lukas Kahwe Smith" Cc: "Lars Strojny" , "Felipe Pena" , internals@lists.php.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <46ccd1ab0804170742g142ed562t4f03339da549a820@mail.gmail.com> <1208466868.4430.10.camel@localhost> <1208478266.5763.14.camel@pena> <1208500782.4430.14.camel@localhost> Subject: Re: [PHP-DEV] [RFC] Strict type hints (parameter and return value) From: paul.biggar@gmail.com ("Paul Biggar") On Fri, Apr 18, 2008 at 9:03 AM, Lukas Kahwe Smith wrote: > Suddenly I need to ensure that all my variables have the proper types. So > what will people do? > .... > So maybe an "(int)" here or there > is not so much more code to type, but you can already see that code you safe > on one end, you have to start adding on the other, the one which you write > more often. You are right, of course. I stated before that the hints automatically casting the parameter is the best approach. With automatic casting, which seems to be fairly obvious semantics for type hints, you will not need to cast at call-time. > More importantly, in some cases simple type juggeling with > "(int)" will not be sufficient, you might have to do some minor checks etc. > In the past library authors did this as part of the code that the strict > type hinting camp is now hoping to remove. So again more code in my glue > code. There isn't a strict typing camp. Felipe's first patch was just checking, which didn't provide any guarantees to the library author. The second was strict typing, which provides guarantees, as you say, at great expense. I am hoping that the third will be casting, which provides guarantees, at no call-time expense. Paul -- Paul Biggar paul.biggar@gmail.com