Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120406 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 66216 invoked from network); 27 May 2023 19:13:44 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 May 2023 19:13:44 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BE19A1804BE for ; Sat, 27 May 2023 12:13:40 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 27 May 2023 12:13:40 -0700 (PDT) Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5557b621ceeso513925eaf.1 for ; Sat, 27 May 2023 12:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685214819; x=1687806819; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=7jGK/w8wZkmCqbjOJmlatyyNSWzK0SHaxeaDQwgV0sU=; b=eUFC+kQxXAdKXcaeOVcAoksYis0vqZCIyoQJg8/kng3WcVYj66jkX6g5zBbalWRib7 c2uYy/6DPLh32JcKBtI4m7KRCjB9HzBfde52dPpLU4QiqPbquKKBQsJ6drf6D0x4/XfW OXkjk10UVr/lEDQEt9IwvoGeqsZnyx8QMxHo602KLoHfidStV7CLwudfgNuMKu0S7xFC uwJJgpCqk1ZD1Es92MWVVsATlrzsxUdUCPKrOzL2lZq24ti0sxy42/zv7YfUpX8odSUf rWMqD7j7kq/18UY2mF9Cba7mvTZ0FSz+nfhA3hmceyDCKOyc76m7Yf0mkgt7Npe6nCVV xrog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685214819; x=1687806819; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7jGK/w8wZkmCqbjOJmlatyyNSWzK0SHaxeaDQwgV0sU=; b=hO7IPzVSdAo2i1cojF7A7ioFUFBJ6BansYx4GgG2bch2MkgjTHP81ThUZoI9UFo1e3 OGawmddq37cm5QW8LO7McFXlSKa5tVhheNqBQ4Im7Eu2ez/JTDdbkB98IZ7UCXmmTWrh CFkSch6eBl2z5O5Ss8rCwKtMQjhPdxSg3juT8eojtT44gOIEk+s3tyLbopjN6fC1sIhJ 6HWdermDR07VMBFYHXdQDlzT4Ek1vuMeA/Bg1WeoYxGyJj3eYHP/4CS74vEWcs9d1lUN jn8/92Znpc0Xr/vqj3fVrQJwp5E4IrfhZW35R3zZxTC4GRe3rU72V3oC0+8H/V3iYycn Tvfg== X-Gm-Message-State: AC+VfDyp8C30jsMFFxQjW9tbOjiPyEyZQNPL8Er6vzLKoBTcDxowZdUY ScXDdHDWzc/G2lmPC6tmvdt8/95SFcKObs+9ZWaygdEs X-Google-Smtp-Source: ACHHUZ4DUhyoWwLqhDPAZIbl39PqSRLaNTyvvcBr+pw5/5LnAWIFu5Egw3lzyYdUpn3uyd9WmYOnEfXnSr9PIS1G5iw= X-Received: by 2002:a4a:98ad:0:b0:555:48c0:cc63 with SMTP id a42-20020a4a98ad000000b0055548c0cc63mr1234293ooj.2.1685214819082; Sat, 27 May 2023 12:13:39 -0700 (PDT) MIME-Version: 1.0 References: <0a54d9a6-98f0-4580-af6a-09435c82bf63@app.fastmail.com> In-Reply-To: <0a54d9a6-98f0-4580-af6a-09435c82bf63@app.fastmail.com> Date: Sat, 27 May 2023 20:13:27 +0100 Message-ID: To: php internals Content-Type: multipart/alternative; boundary="000000000000a967ab05fcb1a6e8" Subject: Re: [PHP-DEV] RFC [Concept] - Interface Properties From: davidgebler@gmail.com (David Gebler) --000000000000a967ab05fcb1a6e8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, May 27, 2023 at 6:24=E2=80=AFPM Larry Garfield wrote: > On Sat, May 27, 2023, at 1:39 AM, Nick Humphries wrote: > > Hello internals, > > > > Based on a few discussions I've had recently, my team and I couldn't > > think of any reason why we shouldn't have properties on interfaces as > > I wouldn't support this, personally. The reason interfaces in most languages which have this concept don't support defining properties is first because they are generally seen as an implementation detail rather than a promise about supported behaviour and second because interfaces are essentially an alternative to multiple inheritance. At the point you're mandating fields as well as method signatures, you're barely one step away from an abstract class anyway. If you still want to combine interfaces with shared properties or default implementations, we already have traits for that purpose. In PHP, two interfaces which define the same method signature can be implemented by the same class, which is at least a little bit iffy in itself. It becomes even more problematic if multiple interfaces can define the same property, because you now don't really know what, conceptually, that property refers to. > Interface properties are already included in the Property Hooks RFC, whic= h > should be going to a vote soon-ish. We hope it passes, of course. :-) > > https://wiki.php.net/rfc/property-hooks For the reasons I've said, I'm not loving the interface part of the property hooks RFC either, to be honest, though I do support the broad feature. I can appreciate that when an interface is used with the hooks, it's more akin to saying an interface is defining setSomething() and getSomething() methods rather than defining a property directly - but it feels like it will encourage writing interfaces which break encapsulation. -Dave --000000000000a967ab05fcb1a6e8--