Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109476 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72741 invoked from network); 31 Mar 2020 08:42:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 31 Mar 2020 08:42:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 528291804D3 for ; Tue, 31 Mar 2020 00:08:16 -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=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 31 Mar 2020 00:08:15 -0700 (PDT) Received: by mail-il1-f172.google.com with SMTP id f16so18398922ilj.9 for ; Tue, 31 Mar 2020 00:08:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f9EjlR4mgW/wUWRVHKH+qZZela2kSb6LZvkAH1b4xvY=; b=Ynrpsyx6LeFec7c7/MSjvfXuz7Q1rxjQjKACwfnnn6+S6YAVhBEwILsa9jShLcWC6I sxOKOBN9+SGzEB6lHB4eeC1mD6ZhTnRPpBfnNvgeW7GdvuNZHiTv7qbU4Pg0lfgC8kK7 Gay26ZtBMSpnJtxe4mxF5M9JTxi4sD10gAZSL0HJsmiO+s9bNLmCQ8v94X6iwa27xVMg zNYXXHs2trf5TnF2DPYCaU2Fw0FkqzeOBrCQeuywCTcLPEeovi4fUmMBqLlDVipnR6A7 v0k1D4kbOa96bU0G5nStUinoogNyBT68VFhKfiYLQ60ovyeSYzCHJQa1bewYE8uLgaP0 Z4jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f9EjlR4mgW/wUWRVHKH+qZZela2kSb6LZvkAH1b4xvY=; b=ejiZ2njcQpM1JNJCNRS0fa+QvRx3h1rOxUDTLX84QJO3EvD6B2IBUcZ5LD7OLVY7mr O7KqfTC2Ir2LKwxy4lN4C30+5NfCq3zE1Y59ud5yitviMiMTzQz1awonm6+nc29shw23 GqreqxxDv/b0YTa+SMS202vKARJ1p7jDiQW/aa+78bDkIPVOHNJY4D2A5bWfl9XGtWSy D+6IN+tefQBroogrLLvd9ftjeDcQXnAsbaAK7WVWRpUTXsR9HSaB+n5alDL+42ngRj0b ExV1gCaubwevZA7O5agTJ/0Y8Mvp706L+qYmn9jSmTk08hlKP0UrWXDK5XV00Gf+lf4J 0qig== X-Gm-Message-State: ANhLgQ2mPSjWP7g9fmXGx8Pf7q3c3y2DkeAdmY8z7v1s38RIqswAZLuv x2YOmDIEE9B3eyOT5nLx679cl3A8sG5QHHcHPgAJhA== X-Google-Smtp-Source: ADFU+vu53m0Noqq36MQ852dkicUPEAXLKdyRRlfrz1Wu1aEljj34obKhxrRjaY1in/xPIgPFGIBEWVR4gzUzhEtuwC8= X-Received: by 2002:a92:c525:: with SMTP id m5mr15564543ili.146.1585638494824; Tue, 31 Mar 2020 00:08:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 31 Mar 2020 09:07:48 +0200 Message-ID: To: Jakob Givoni Cc: Larry Garfield , php internals Content-Type: multipart/alternative; boundary="00000000000039ed9c05a2213bd5" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Compact Object Property Assignment From: kjarli@gmail.com (Lynn) --00000000000039ed9c05a2213bd5 Content-Type: text/plain; charset="UTF-8" Hi, > In this case, the problem with COPA as proposed is that it only works for > public properties that are assigned literally. That is, in my experience, > a very rare case. > > You see, here's the funny thing: It's rare because it's a hassle! > *MY* experience (I do have some 20 years' worth of such...) is that > people tend to use associative arrays instead for data records and the > like. COPA aims to change that. COPA won't make me use objects instead of arrays (in legacy code). The problem is writing a ton of classes for all array ever used, in a legacy file structure that comes with more maintenance than you'd like. What would make me use objects would probably be run-time interfaces via a return contract in combination with anonymous classes. > > Most objects want and need to have private or protected properties for a > large variety of reasons, which would make COPA useless. > > Ooops, careful with such an overstatement, buddy! I don't want to > enter into this debate here, just point out that this generalisation > is overreaching. > I don't remember when the last time was that I used public properties, even for the simplest data objects. Constructors provide all the features I need at this point, and I'm much more interested in making constructors have less boilerplate than their initialization. I can imagine COPA being more attractive once (public) read only properties are a thing, though even then I'd much rather use a constructor as it will let me find usages and add/swap arguments easily. Finding COPA usages of a class will be a lot harder compared to constructors. Regards, Lynn --00000000000039ed9c05a2213bd5--