Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110876 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 17644 invoked from network); 8 Jul 2020 10:09:32 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Jul 2020 10:09:32 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DA7D418020B for ; Wed, 8 Jul 2020 02:00:25 -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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 ; Wed, 8 Jul 2020 02:00:25 -0700 (PDT) Received: by mail-wr1-f43.google.com with SMTP id a6so48023694wrm.4 for ; Wed, 08 Jul 2020 02:00:25 -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=cEUTMYks/5MNBKFU3vwJpII/NjF1P3eMd+FbFak9I08=; b=qtZrvrKedEoBSv57QcbWbBm04QZHycybvc7XLdzZAvkqYN9nQ6lbHnyAiHy10HOjTl Y6H3F0GI1tJvlltauPusj5cEDUSUGEociv6wujS89PZm7PwOr4kL5HXFJ2yDlfuahqXJ BKvmq0MCghnTepXze3jaQHGThdx3qZnbv79d/gJQVfkKe/ZawpDdksjJyo+2pF05UU0R 7d0O8QLP9Hb81x2qVnu0tZ0G4FN6niSlBYVIPv1rt7XioDJEza/dTWGGo7wkU4QWLv0Z SlQaDWwZ7MONynCKyX2KsP/2Q6yyMmvEOB6nP3TCFNKUxAuW8azooA7m1uVR2q2vgiBw e7Bg== 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=cEUTMYks/5MNBKFU3vwJpII/NjF1P3eMd+FbFak9I08=; b=EtW9hzM1XidrhKSExMIp67nD7+9rbSQuYHieT681Df9oLyso6i6mpcE7z8ZARG8xYx knMHsWL7XKybg8XdTzzM+1i9gpcPNvyrKmx0duJ4vcPnlUbJdybXv702wmBHxy4RqQsx RE4b0whiM0fpQhAjhM4jupCTslniaWTYpJPGyhHY2WJjmUqk/Cd0YnEe8xlEIYuRLwC8 +6AMgNBFgtSUtsmlPf/HbcCCor64QRJYg7XP51OvCLv3vX6nOmZ9fZJJRyN3u7rM0+hb r36tqegmVxVyYndNNGWxilDLYsk+nF2YnCq+wO6EjLtcbrn1F3zSMhmBRnQQKBfiV1q3 rBVw== X-Gm-Message-State: AOAM532jQHVV1XRxz4pjUD1TwaTPMpyn/Y+Rcw+gCtZATtEhHXVV14X5 eTKV6dFA8RGw4mf1ZO4stn86JDdzIcipm19JKZM= X-Google-Smtp-Source: ABdhPJyNdCw1N1viJtrUPoJqUzaAXDAbdmemSBUKMxXveVp5YYWry4h+mbLF7PC3tC+tz0GIbHkFDYTGUGhJPXNRlSY= X-Received: by 2002:adf:f04c:: with SMTP id t12mr54524988wro.382.1594198824267; Wed, 08 Jul 2020 02:00:24 -0700 (PDT) MIME-Version: 1.0 References: <0431210B-417F-4576-BF28-E51ECFA8F3EF@joshbruce.dev> <15F2E346-4B74-401D-9993-0DFAE8C0A988@joshbruce.dev> In-Reply-To: Date: Wed, 8 Jul 2020 12:00:12 +0300 Message-ID: To: Rowan Tommins Cc: php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Proposal: A way for classes to define a response to any primitive type cast From: someniatko@gmail.com (someniatko) > This would seem to fit your use case with Shoop quite well: > rather than Shoop::array($array)->first()->unfold(), you would just call > $array->first(). It's fairly high on a lot of people's wish lists, but > there's a lot of details to get right in both design and implementation, > so I strongly recommend searching for previous discussions and proofs of > concept before diving in. We don't need methods on non-scalar objects, if we have [pipe operator](https://wiki.php.net/rfc/pipe-operator-v2): sth like `$array |> array_first(?)`. This would allow much greater flexibility.