Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105690 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 37815 invoked from network); 13 May 2019 20:46:26 -0000 Received: from unknown (HELO mail-it1-f174.google.com) (209.85.166.174) by pb1.pair.com with SMTP; 13 May 2019 20:46:26 -0000 Received: by mail-it1-f174.google.com with SMTP id 9so410099itf.4 for ; Mon, 13 May 2019 10:51:52 -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=Z/OsNpu8WWQCwfT/ha10dHNco6KC38TAqN6ZinkmLqs=; b=EQ2f96MvagLelWyJM7cQlmYzHFNmR7TCQhpZERFdYigg2iCUr45Whp8QfhPHp+XBtJ rK0FYF3JWb9UoyGGL8tyfvMUrLrMUpBx/I8+W9yQWii+Ue1CpmnD5+9hruP6U8hpgwNT uqn3QoLMxn4yXTZlb1xxH4obCW7y2gbhxSPCbOvioMYhIpknD3rQHpLgGV0Tt+gS1qU+ VwPI8vi7YEvRgJhKycPKIKLYxFLS7vB1k5sFdVJ+TuFtbQc7ElLHmSE/IMNoM4QwESVw LON/wZguJi8Uxxe3oCOXhabwt1rWGXZXidoArP528QRJtGTF9WmwQqrP49bMr1ko4S4E Sf9w== 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=Z/OsNpu8WWQCwfT/ha10dHNco6KC38TAqN6ZinkmLqs=; b=YmcghlH6nFJBJNjEhnuW94OIMARzuM9DoRxbj37pHDRExGXruMw/9PGxyeDU9YOWfV eH3NVU9DoBOEEuc1zcRL2gqKBc0afBZT5rNf77QNmMhzz16XqBor//7v2F4jkF5wQwF/ w0UNsU7f4CLooWopCBLV1kNbPhCY5vRUL7LJ7h21f22EpURBEhGhMK331P23WyrJY8PW nz+jvoAAlAsVH+brFbdD7DAFQ3pccOTZJFtt5vF6msbuHnC5tJTmNTNxGH0x5JvyqS7s DtV5kueBVq/qYc6htSp6iI0fbuB09YndSuKvzqvg+yiqmjt+s7PSYS6H1jd0BI1GyqRs ZdMA== X-Gm-Message-State: APjAAAWUcCj28wYFqlhaDOAg0Q1sY/rKKRdD5EYM/PUXiV/PtFzBBlzs Rz9t6zMymacDmosPv8ns7+WEyNhD5u6/kZyFG5s= X-Google-Smtp-Source: APXvYqzgoFS+g3Qj7//7UxQTraxxNNMmqSqkZGfuq4FH0wjXysSIy0Pf4RnLrMQePnxSpkn+qoAThmLQkbrXgu56P5o= X-Received: by 2002:a02:a784:: with SMTP id e4mr20293696jaj.142.1557769912502; Mon, 13 May 2019 10:51:52 -0700 (PDT) MIME-Version: 1.0 References: <1946899E-7EFC-4206-B26D-CD44838315A3@gmail.com> In-Reply-To: <1946899E-7EFC-4206-B26D-CD44838315A3@gmail.com> Date: Mon, 13 May 2019 19:51:40 +0200 Message-ID: To: Steven Wade Cc: PHP Internals List , Jessica Mauerhan Content-Type: multipart/alternative; boundary="00000000000046d16c0588c892bc" Subject: Re: [PHP-DEV] Re: Proposal for a RFC From: ocramius@gmail.com (Marco Pivetta) --00000000000046d16c0588c892bc Content-Type: text/plain; charset="UTF-8" Hi Steven, On Mon, 13 May 2019, 15:46 Steven Wade, wrote: > > On May 4, 2019, at 10:58 AM, Steven Wade wrote: > > > > Hi Internals team! > > > > I have an idea for a feature that I'd love to see in the language one > day and wanted to run the idea by you all. > > > > The idea is to add a new magic method "__toArray()" that would allow a > developer to specifiy how a class is cast to an array. The idea is the same > mentality of __toString(), but, for arrays. > > > > I would personally love this feature and those I've run it by were also > excited by the idea. So I'm soliciting feedback in hopes that things go > well and I can officially write the RFC. As for implementation, Sara > Golemon is awesome and while chatting a few months back, knocked out a > proof-of-concept implementation < > https://github.com/sgolemon/php-src/tree/experimental.toarray>. There's > still work to be done if this proposal gets to the RFC phase, but again, > just gauging interest here. > > > > I appreciate any feedback you all can provide. > > > > Thanks, > > > > - Steven Wade > > Hi all, I wanted to re-ping the list to see if there is any more feedback > on this proposal? Any technical concerns or true BC changes? > > This feature wouldn't be as exciting as the others in 7.4, but I think > it'd be a nice little helper, and the community feedback I've received from > developers has been positive, so I'd like to keep the conversation going. > I don't think any of the discussion points mentioned above is resolved: a heavy BC break on the `(array)` cast instead of introducing a clear `SomeArrayableInterfaceType#toArray()` (to be explicitly called) is a no-go from my end, as no clear value is added besides more language complexity, and more mixed cast is encouraged. Greets, Marco > --00000000000046d16c0588c892bc--