Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112478 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 52082 invoked from network); 9 Dec 2020 21:00:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Dec 2020 21:00:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5612C1804CF for ; Wed, 9 Dec 2020 12:29:53 -0800 (PST) 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-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) (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, 9 Dec 2020 12:29:52 -0800 (PST) Received: by mail-oi1-f177.google.com with SMTP id d27so3169931oic.0 for ; Wed, 09 Dec 2020 12:29:52 -0800 (PST) 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=+8BxrsF5a/j0dFSGoo+lQR+44N0j3qxRa7PO2BGOo8U=; b=PILiaaVdSvymkALpOl83RoDe+aAtLfGW+Cp3f/vBc/DrNmor1AcNOLiwNYxMZyCbi2 2EBp4rL0rNfXsW9uHNfU3wbwjVkVT8MeiEHE3UEo9P48Z31tAjmYhQBav8AqTp4Nc9QT D+avcAL1q5BJi0UOaV32Nb37wc82WWMemWMmXFs/2bK8NWjTHZdjAVqu1asWPb7gV1YA dXxnyPPgC305BSwh33sKDBrPwwFrvlsjR3E811HUrpw5CXSUCptLeW/6EnUQnTpQGa4b QW7VHrbODUnj5LcCqwPqN6x16D6vQKvA9ekTuDpaJCwUT2k4NKI1nrRUsDnjj+YfkeL1 AR3g== 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=+8BxrsF5a/j0dFSGoo+lQR+44N0j3qxRa7PO2BGOo8U=; b=PskpeRqtL57yZDuadZiGZM67Akbp6lk30TKvra8Odevp57TiyUw+EVexKdLdTY6QJI 4AFs5//JRAP+zdfvj74caJV4GfbDDdnnUgfMAQCQayHN9lNVgbDbN0zhHLurUhcaZg0L q2Rn0E00nfoWVdDZcdH/PpRRAIImr7MPMgOa8kU5QyKNcaus2gbMAklhmgD/OztWJJkS y45ZgYwiVTPuxxL98KI9hbFugPFDckxZW7kO09lMUoUJV7G3YoOFSUw0yJHsw5gyhm4F XlPIfEc11sgh71Pp8+qwc9MaXRZWGNY9gd83fc03miw74Urbkn+pTGmHz6e831McdbJP CbRg== X-Gm-Message-State: AOAM533JxmQAfGRlE0k4+YpHfvMaoSiJGY6yb9D6PkXG4XQlFTzl6xCr iicIDP9gmp5RTYp2/ziTVcEiPeA3xWVzm0OUWJ7FiMKzP1s= X-Google-Smtp-Source: ABdhPJxr8lDQ2Oo5rROTI3XhODMdsw74JsHNsxBiOKb3glFBzANFrTMrG1O4F/OOtbmRRvBc0AstYIK8/bh4YTt9EGE= X-Received: by 2002:aca:e082:: with SMTP id x124mr3111177oig.3.1607545790122; Wed, 09 Dec 2020 12:29:50 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 9 Dec 2020 21:29:37 +0100 Message-ID: To: Mike Schinkel Cc: Larry Garfield , php internals Content-Type: multipart/alternative; boundary="000000000000c7d15b05b60deb37" Subject: Re: [PHP-DEV] [RFC] Enumerations From: benjamin.morel@gmail.com (Benjamin Morel) --000000000000c7d15b05b60deb37 Content-Type: text/plain; charset="UTF-8" On Wed, 9 Dec 2020 at 19:48, Mike Schinkel wrote: 5. Someone else mentioned shortcut syntax, which I would like to mention > again, although I realize implement details might make this a non-starter. > > So if I have a function that accepts a Size from above, e.g.: > > function show(Size $size) {} > > Then it would be great if we could call the function like this since its > parameter was type-hinted: > > show(::Medium) > > Rather than always having to write: > > show(Size::Medium) > > So can we consider a shortcut syntax? > I'm not sure what value a shortcut syntax would bring, but it would surely break, or at least make ambiguous, union types: function show(Enum1|Enum2 $value) {} show(::Medium) Which enum would Medium resolve to? - Benjamin --000000000000c7d15b05b60deb37--