Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48830 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83355 invoked from network); 18 Jun 2010 16:18:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2010 16:18:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=rquadling@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rquadling@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@gmail.com X-Host-Fingerprint: 209.85.160.170 mail-gy0-f170.google.com Received: from [209.85.160.170] ([209.85.160.170:60906] helo=mail-gy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 05/93-59924-B6C9B1C4 for ; Fri, 18 Jun 2010 12:18:52 -0400 Received: by gyf2 with SMTP id 2so1056339gyf.29 for ; Fri, 18 Jun 2010 09:18:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:reply-to :in-reply-to:references:from:date:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=q/e8+Kxc6H4++aVmqO1rEd3ZUtT+uIjLjeh6d3DEEPU=; b=FlZfhg213taHVUZs78N0eN0guFxQ3IPff84TcC7Krc1O+E113s9C64SqQAHtljEiw5 X8IDGGlp/wzxtMMH3SFzz4MCLYB3tu/uEmp2+sqDReY8xxvOT21Q71B2BWW59hFUqsuM 1TAwlA8LCl4V/PVSfFdJKJ1ErY2w2h4QrBmwo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; b=nlLc0ZlNAO6B2uOKDThHwdXegwDa85EL/ymp2J6XHoaYr09C9KeJ+ZZvxdA/wwoRJp KZImsfWbtEbFhvx87JiGuwyeXOyVoVvfTyCpaBGp5yGCk8avKwdZAaABTru9klvkmjV0 kNKaAl0MoGaWSnb/0vaV9TkXpXpM/QDpo9Sqo= Received: by 10.101.135.35 with SMTP id m35mr1106090ann.51.1276877924185; Fri, 18 Jun 2010 09:18:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.120.7 with HTTP; Fri, 18 Jun 2010 09:18:24 -0700 (PDT) Reply-To: RQuadling@googlemail.com In-Reply-To: <16FA8F9A-E36B-4057-BBCC-D6CC9C8D6D8B@php.net> References: <4C1A6B47.4060702@mohiva.com> <4C1A7400.6010800@sugarcrm.com> <16FA8F9A-E36B-4057-BBCC-D6CC9C8D6D8B@php.net> Date: Fri, 18 Jun 2010 17:18:24 +0100 Message-ID: To: Melanie Rhianna Lewis Cc: Stas Malyshev , Christian Kaps , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Type hinting From: rquadling@gmail.com (Richard Quadling) On 18 June 2010 15:13, Melanie Rhianna Lewis wrote: > > > On 17 Jun 2010, at 20:14, Stas Malyshev wrote: > >> Hi! >> >>> I know the discussion is about scalar type hints. But what is with a >>> object type hint as base for all objects? >> >> When it makes sense to accept any object, regardless of the class, but n= ot other types? I wonder if it's really a common use-case. > > Its useful in some patterns. =C2=A0For example suppose you have a pattern= where a class wraps another class. =C2=A0The wrapped class could be *any* = class if you're modify the behaviour of some default methods (say doing som= ething like a decorator pattern). =C2=A0Having a type hint that recognises = object vs non objects is useful. > > Melanie > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > class::method(object $instance) would certainly be useful. Could this not be solved by internally extending all userland classes (and whilst we are at this why not all internal classes) from a PHP supplied empty class? Maybe stdClass? scalar, array, class, interface, untyped class. --=20 ----- Richard Quadling "Standing on the shoulders of some very clever giants!" EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=3DZEND002498&r=3D213474= 731 ZOPA : http://uk.zopa.com/member/RQuadling