Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114873 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5674 invoked from network); 14 Jun 2021 23:20:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Jun 2021 23:20:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 94C63180507 for ; Mon, 14 Jun 2021 16:36:48 -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 autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 ; Mon, 14 Jun 2021 16:36:48 -0700 (PDT) Received: by mail-ej1-f53.google.com with SMTP id nd37so11569898ejc.3 for ; Mon, 14 Jun 2021 16:36:48 -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=E8eh7gzAbOvg6LTSePExNhPeo8bMTqZ3zmC8+nx8BNc=; b=SX7GL2jsmWIbhUZlEV+ub4Df5R93tmnJXDUhETg/ACLDQS7yLmWLRro8AOtZ7KDoRq Pk06AAb6OinJJ2rT0g+ZIPLFJpNg89/dw0Dy6Tnyk9njehkSqfulptnSlkZGYb962H0w iHSP+wos+zhK0pnEmNR7GTwWFLvqJorX0xczM1c8T5LZI7tQaVFX1rqGiuWCAGiUggeT WyZA+NspDkRk4AkSipoTi9cgkZpPYIvwqRJTTmYABkYXhEUuUqTMA+fAKNyGnU2CKQdR orAoFLxJ5dW+ZFg5zaWB0kfmUI3d6YarQvHlru/3/ROVeLmsuXAeC4vAuZWPjJYebbZP Bawg== 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=E8eh7gzAbOvg6LTSePExNhPeo8bMTqZ3zmC8+nx8BNc=; b=I5DH4fMW6SszurKKEmtPH6nR+67n65D/8Luje7kO0na/cDQFUWz4ox0nZ3xd5VOr/P 0yuvx9nZSKIUkWrt8Y2YISzPc65QnyWe8tJWwqtHiwUcxiaoiJ1FXDXYg0d/mEujq55G b40iqdCG0X2vzHPiqQiDtSOQ4rHfAKU4jADRh/LRw4c3FmqlW15nwetJY/EtHm2hF12x FuOpa50r098s39nYqUoZt+h2gvl9DGVwpJPDtVCsULtwpq/sob9vcK+sWybnqj/aYC7d uep7AO8fmSm3Gb+2hPlSp1QHhXcoiW9/BvtNy9x73ohtVPzaxv28aHNLITGdOAEvUVkW pQLQ== X-Gm-Message-State: AOAM531lkd6sSSm2HMgluqAB4hkFwIySpn29/QiAjnUCLE4vUp5RX/Iy ctddSWG/Ci7H0jpA59UaacLu01slnoQwQxVMO5GY4ESRLhc= X-Google-Smtp-Source: ABdhPJwxzKsW8azQ5dQBIoEC9BF04q+1o5tepmMr0Qzmhk36qmuDUBA7MkPkEoJ74JdOlAiFCGaVdwAttB7PVBU0Gm8= X-Received: by 2002:a17:906:2c54:: with SMTP id f20mr17610293ejh.91.1623713806866; Mon, 14 Jun 2021 16:36:46 -0700 (PDT) MIME-Version: 1.0 References: <88132afe-0d3a-4891-8d17-7fad155b5f72@www.fastmail.com> In-Reply-To: <88132afe-0d3a-4891-8d17-7fad155b5f72@www.fastmail.com> Date: Tue, 15 Jun 2021 00:36:35 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000acdc7b05c4c254cd" Subject: Re: [PHP-DEV] Allow objects in define() From: dragoonis@gmail.com (Paul Dragoonis) --000000000000acdc7b05c4c254cd Content-Type: text/plain; charset="UTF-8" On Mon, Jun 14, 2021 at 7:47 PM Larry Garfield wrote: > On Mon, Jun 14, 2021, at 9:35 AM, Nikita Popov wrote: > > Hi internals, > > > > With the introduction of enums, it's now possible for constants to hold > > objects. However, this works only when using the `const X = Y` syntax, > not > > when using `define('X', Y)`, which still excludes objects. > > > > I've submitted https://github.com/php/php-src/pull/7149 to relax the > > restriction. This means that define() would accept everything apart from > > recursive arrays. > > > > An alternative here would be to allow define() to only accept enum > objects > > in particular, but not other objects. I would prefer not to do that, as > > such a restriction would be rather arbitrary, now that the technical work > > to support objects has been done. (PS: Please keep the difference between > > mutability and interior mutability in mind.) > > > > Regards, > > Nikita > > Sounds fine to me. define() is runtime anyway so it should support > runtime values. > Sounds sensible to me too. Good enhancement. > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --000000000000acdc7b05c4c254cd--