Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115388 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 37738 invoked from network); 11 Jul 2021 18:04:04 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Jul 2021 18:04:04 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9FBA01804D8 for ; Sun, 11 Jul 2021 11:27:07 -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_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-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (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 ; Sun, 11 Jul 2021 11:27:07 -0700 (PDT) Received: by mail-yb1-f175.google.com with SMTP id t186so5637114ybf.2 for ; Sun, 11 Jul 2021 11:27:06 -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=QJhBeBHtqM4Z1tlmGf0NoZFzWmuTqPhWSppw/8fXgjo=; b=uSHAmH1MHgtdZLVNxvY0GOZCdnTMxot51xvOs1sjvFciUCVjMyhus0o0Cu6BWx1m/7 Lze4pkQ2GNl0DHOEwfgHVRDpTz26nQzrvHq9eUY7TLlnvLcMZxZGCrPH+QZwbjDSaDca 8O5B5lxzO66Ne7uCk5jGmcImqd15GdXWZ27qkDW8+x115EE0FPWEMoBI69U4fPF07/az fWbI05MumlaqB1vQ/MjKJ5YUMHb/HyWVn0oTgCANu/iCa1lU7kag3q2W0Wg8QYxMpTBz IeoO0/Edy9A1eWS0Vc/5UM6qrmcyZmn5r808nev/atCWzYGSfPnvtDrgTN3GPgsXEj9m rFyg== 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=QJhBeBHtqM4Z1tlmGf0NoZFzWmuTqPhWSppw/8fXgjo=; b=BuUPohP+vMMuqtknFwrtHeeexdf8iwwGf+DE9UJsAu2sRK0eF9B+SXdvlhq7FocObI n0RB9Wi0l5cOGuk9B5nka5nOYnrzb2+uOy5Ju+hfrDvi2hxogF1edIW4eJVza2Fx22DO +sEj8LfmnRaYokkCLqf6dz2ZN3YccsOuUuaE9znWH+KtFkuoblXLmZYDAAZ+iNm9eZRu SKZucLxqMPRA0Y7bRqkOqUdGD/oWYuKoI4zn3Pl+0+PL+N35htw50Siqpc4ikxQdasNQ c3Q5CcffdM3639c8zWxt+vkeIjrOh4UVkMbyw+U+69nZF7ZVrN9m31Co5RJD/bgCcG/C RiIQ== X-Gm-Message-State: AOAM532OS7FwgGosQn9Q/I6kfJsGugcy9kosf5kjMz6KqS7kobmJfgSe JKJw4oq+wm+rZJDrYpG0fZ+libN9Tl5nHoTWK2E= X-Google-Smtp-Source: ABdhPJxTuO21gcsvX+XGfp+7Q1ynR0v8Tysu+aZTRd3Sqz911aQFFkqge96tSjLI6kn8D+74EvxwsTmHbeyfaQM1FzY= X-Received: by 2002:a25:b886:: with SMTP id w6mr7193534ybj.167.1626028025636; Sun, 11 Jul 2021 11:27:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 11 Jul 2021 21:26:54 +0300 Message-ID: To: Marco Pivetta Cc: Max Semenik , Internals Content-Type: multipart/alternative; boundary="000000000000dce96105c6dd2611" Subject: Re: [PHP-DEV] Type casting syntax From: zsidelnik@gmail.com (Eugene Sidelnyk) --000000000000dce96105c6dd2611 Content-Type: text/plain; charset="UTF-8" IMHO, This is suger which leads to diabetes. It adds pure implicitness without any payback. To convert object into something else add appropriate method. On Sat, Jul 10, 2021, 3:07 PM Marco Pivetta wrote: > Hey Max, > > On Sat, 10 Jul 2021, 11:09 Max Semenik, wrote: > > > I've been thinking about extending PHP's cast syntax to user-defined > types, > > e.g. not only (int)$foo but also (MyClass)$foo. Currently, a T_STRING in > > parentheses is always treated as a constant - would it be acceptable to > > hijack this syntax when used in unary operation context, i.e. "(" > T_STRING > > ")" expr? If not, any other alternatives? > > > > How is this any better than `MyThing::fromStuff(...)`, with proper tested > and domain-specific semantics? > > > > --000000000000dce96105c6dd2611--