Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62138 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74728 invoked from network); 14 Aug 2012 08:52:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2012 08:52:19 -0000 Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 209.85.217.170 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:55124] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A6/84-00812-0C11A205 for ; Tue, 14 Aug 2012 04:52:19 -0400 Received: by lbbgp3 with SMTP id gp3so113774lbb.29 for ; Tue, 14 Aug 2012 01:52:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=C8viCXUdsM8A78tIetvFo36zB5ibzaSrmfEYR9ofs+U=; b=o0Ar85LyfkrAOOk+YM0eFnGN6iLeaYcR8pA3VhhtBg+0Sn/Z/iFvO4MrKpYZVvtII0 T1ei3brFrGcz6aEQHEJiM7NAOObmakKSKAcB+T7HcQP+mVdZvFctayjWhl6Lj5Z0R3Sw AjdYYEMN0HKcMeSUxyxncU3Zctt80668bgigIF5Vy4n0aXONjVzGRb2m6f4E/JcH9oCQ qyMJ4I2jNSXckxXqNoB+NKzonbKGyVjWvVOVMRTzTumLb+PNhfGskxlHDaP0bhI4Zg7r vzEpzfXSth9bhoy8ciLGbE9QQNqqhKGB0gbVB70FecuXB6dBF4QuL3d9/PJWCCAetHjA tFvA== MIME-Version: 1.0 Received: by 10.152.108.42 with SMTP id hh10mr15227086lab.9.1344934333612; Tue, 14 Aug 2012 01:52:13 -0700 (PDT) Received: by 10.112.127.105 with HTTP; Tue, 14 Aug 2012 01:52:13 -0700 (PDT) X-Originating-IP: [178.200.247.30] In-Reply-To: <5029F1EA.5040507@sugarcrm.com> References: <50298AC9.4070302@naderman.de> <5029F1EA.5040507@sugarcrm.com> Date: Tue, 14 Aug 2012 10:52:13 +0200 Message-ID: To: Stas Malyshev Cc: Anthony Ferrara , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=bcaec54fb9c633817204c735ed39 X-Gm-Message-State: ALoCoQm4bPCVTixCl5nz47Ccfh9tf1gFD5gbN0gHgKCR0ice0G6JsJ3xZyBOidoe0mbDMQ0rEHx1 Subject: Re: [PHP-DEV] Decorators Revisited From: kontakt@beberlei.de (Benjamin Eberlei) --bcaec54fb9c633817204c735ed39 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Aug 14, 2012 at 8:36 AM, Stas Malyshev wrote: > Hi! > > > 2. Move instanceof to a handler from the current standalone function. > Then > > each (pecl level) class could choose its own implementation if it is > > needed. The function could still exist for BC reasons, but would proxy to > > the handler method if it existed... Then, the wrapped class (the > additional > > pointer) would only need to live on the objects internal store... > > I don't think overriding instanceof is a very good idea. instanceof has > very defined meaning, which implies certain contract between classes and > their clients, and allowing everybody to override it to mean whatever > one likes looks very dangerous to me. > I think you are excagerating, the proposal is not allowing everybody to overwrite instanceof it to do whatever. That would be if we could overwrite the implementation of instanceof in userland. Instead it simplifies applying the decorator pattern on the language level, and the instanceof only in this use-case. @Anthony: Does this handle get_class() as well and all the Reflection APIs? --bcaec54fb9c633817204c735ed39--