Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48827 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69242 invoked from network); 18 Jun 2010 14:29:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2010 14:29:03 -0000 Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 188.40.37.16 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 188.40.37.16 hq1.backendmedia.com Linux 2.6 Received: from [188.40.37.16] ([188.40.37.16:56875] helo=hq1.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 23/71-59924-6928B1C4 for ; Fri, 18 Jun 2010 10:28:58 -0400 Received: from localhost (unknown [127.0.0.1]) by hq1.backendmedia.com (Postfix) with ESMTP id D6A38200C196; Fri, 18 Jun 2010 14:28:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at backendmedia.com Received: from hq1.backendmedia.com ([127.0.0.1]) by localhost (hq1.backendmedia.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X7E6u1P60emb; Fri, 18 Jun 2010 16:28:39 +0200 (CEST) Received: from [192.168.0.151] (217-162-131-234.dclient.hispeed.ch [217.162.131.234]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mls@pooteeweet.org) by hq1.backendmedia.com (Postfix) with ESMTPSA id 26AAF200C187; Fri, 18 Jun 2010 16:28:38 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii In-Reply-To: <16FA8F9A-E36B-4057-BBCC-D6CC9C8D6D8B@php.net> Date: Fri, 18 Jun 2010 16:28:31 +0200 Cc: Stas Malyshev , Christian Kaps , "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <3C5F598B-3E72-4959-B774-2FD62C1BC99F@pooteeweet.org> References: <4C1A6B47.4060702@mohiva.com> <4C1A7400.6010800@sugarcrm.com> <16FA8F9A-E36B-4057-BBCC-D6CC9C8D6D8B@php.net> To: Melanie Rhianna Lewis X-Mailer: Apple Mail (2.1081) Subject: Re: [PHP-DEV] Type hinting From: mls@pooteeweet.org (Lukas Kahwe Smith) On 18.06.2010, at 16:13, Melanie Rhianna Lewis wrote: >=20 >=20 > On 17 Jun 2010, at 20:14, Stas Malyshev wrote: >=20 >> Hi! >>=20 >>> I know the discussion is about scalar type hints. But what is with a >>> object type hint as base for all objects? >>=20 >> When it makes sense to accept any object, regardless of the class, = but not other types? I wonder if it's really a common use-case. >=20 > Its useful in some patterns. For example suppose you have a pattern = where a class wraps another class. The wrapped class could be *any* = class if you're modify the behaviour of some default methods (say doing = something like a decorator pattern). Having a type hint that recognises = object vs non objects is useful. isnt this what interfaces are for? regards, Lukas Kahwe Smith mls@pooteeweet.org