Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111998 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 7508 invoked from network); 5 Oct 2020 00:50:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Oct 2020 00:50:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E80F91804AA for ; Sun, 4 Oct 2020 17:03:28 -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=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, 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-vk1-f178.google.com (mail-vk1-f178.google.com [209.85.221.178]) (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, 4 Oct 2020 17:03:28 -0700 (PDT) Received: by mail-vk1-f178.google.com with SMTP id d125so699135vkh.10 for ; Sun, 04 Oct 2020 17:03:28 -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=v6IS5x8w4HneUnYGwzXYyZFxRBOR5L4JVVQkt7x17qQ=; b=LVTwnVTmjFDbAHztgIRprGsH9fPB+H/a4xttPd909XrHmYxXBxsnylYL550geQXmDK nGt7xtTHz+RKE9EqbyzqiS4Qz9rtaBxPY2dDGZ3HeW/I019aVgq3Mrd3lg2YQIV7wImN HFmjT0cP2YITM27hWAomWQaQgzbUdtuSfIjNtBLMrfv1FahJAjr06XIEvjGTDY+ywG3B RaTTmklu4FHneFOCRCVki/7HM02Vdrle6cnu4X05t3QxoOBRW9hsb9RZ3U04IP987mVn fSxhf6eanhJ4Z0oWaAM3QWCpPLlH2ykJl/qBxe0D9Pa/Tx64zBuMonNH7Vjh+Si87Bhx zlQw== 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=v6IS5x8w4HneUnYGwzXYyZFxRBOR5L4JVVQkt7x17qQ=; b=fNa/z3NYEMdiEli90ny8qSTjWyUMP4FffNs1aAHJ1Plo3WF/OJlIHRlYt2QF46fncR 92JGGJZs0KcazCvljxlQWCc8hp8ct10iVNOcrWluRN4CPzYVbL/2KsRSsopis1GTqlSM lVh0lxSDsXlj460OmDv/IJjx0IQ1JAJzmsJJtH4wAoVv+lr1r2sZXBbx8Rqy4aUUB1Ka aK0R2Mv1Gbu7Z2c4B8Oli5HI/61Exi+WxWpzBZAZAUqFuJAr99yZLZ22A/8gx5D+flqT 7l5Y8oyTTkrXr2e7a4g5Lh+9kyz5YayQNecfYkIfRIE05QWQIlWExmSUmSJwPZUU/yUz PsAg== X-Gm-Message-State: AOAM532BuynrzRyDSZecdJgo0ecMPMVetBDLPaJx+CZmmPs8tf51R5oj 1DLiVxaqC7wSbFEDeopbTLpo2vlqWWTwDInqgA4= X-Google-Smtp-Source: ABdhPJxhtdw8zI4/eotSe8zVRZHz2CQ707KFu7vspDRQMzYC3feb1ltBHKTH4jQiO2K2sbczETlpeXrpA4wsIX8aHOM= X-Received: by 2002:a1f:5fce:: with SMTP id t197mr1621757vkb.7.1601856205472; Sun, 04 Oct 2020 17:03:25 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 5 Oct 2020 03:03:14 +0300 Message-ID: To: Max Semenik Cc: Internals Content-Type: multipart/alternative; boundary="0000000000001bc84005b0e136ba" Subject: Re: [PHP-DEV] Literal types RFC From: bogdanungureanu21@gmail.com (Bogdan Ungureanu) --0000000000001bc84005b0e136ba Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Yeah, kind of, the problem with enums from what I understood from the current RFCs is that you'll need extra code to map a scalar to that specific enum value. Besides that, a literal type implementation is afaik simpler to implement/spec than enums, thus having a better chance to pass voting. On Mon, Oct 5, 2020 at 2:56 AM Max Semenik wrote: > =D0=BF=D0=BD, 5 =D0=BE=D0=BA=D1=82. 2020 =D0=B3., 02:38 Bogdan Ungureanu = : > >> >> function getStatus(): "draft" | "published" { } >> > > It sounds that what you're really asking for is enums, e.g. > > enum Status { > Draft, > Published > }; > > function getStatus(): Status { ... } > >> --0000000000001bc84005b0e136ba--