Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118910 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 50831 invoked from network); 28 Oct 2022 22:45:00 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Oct 2022 22:45:00 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0A79A180054 for ; Fri, 28 Oct 2022 15:44:59 -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, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ua1-f54.google.com (mail-ua1-f54.google.com [209.85.222.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 28 Oct 2022 15:44:58 -0700 (PDT) Received: by mail-ua1-f54.google.com with SMTP id e22so2409508uar.5 for ; Fri, 28 Oct 2022 15:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Nrk4urV/YI3l1ryEvB4eEXNFy328zqsB3BdNDEl6RSo=; b=dnRJ0PqVAoYOMeDIr8sAvYSA8eECWF+IBzJ2nvI2XCBeeLX74yY+xuAEkvjURTyu1H U0zfDjwxyjpQeAr/QGD5UPjh6JvuB2qcqUTbhv5LEpTdpjFgI1yTKR1TGf7suo2DSP9X 1UwBpi5rTeIY2AKO3Z2Dq0EYg0Qncci+aNscpLihhqM6X7CjCZUMfdlj9GpHVSQgSdkm xXZnF2y1JZqURIHPMl/WyF+tXOH1+H7LFcLhV1CRJuKvZQa3tLSuh5A2ZCq4i7tcAQOQ jq3xnLY44J08V3KEZy6EEk3cbDenzCY/Ch9sgfaBqM+t+uaXZhBU80NSb/Izst5CVnlw AecA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Nrk4urV/YI3l1ryEvB4eEXNFy328zqsB3BdNDEl6RSo=; b=hI6tcANtg6hfWTvn7yC8472h1sUsQaK6w7n19hN0HdLZMZR+kskGYAZ9/A766cZ3QJ I3qRhlPfFQrlxaWfbnpq0vwJ045mF4lNuq9OAGKiyGzI+8Fm8t2MSN1pV50WN9ksCarz k+NYpaAE41OxfAjzRlH5dH9PsT5cZsaItFV0PVeYQsd0ilwteg6uIHYb9as7bBoi8D8F +993qcbpqYlSYPVWdtD515tgrmCPpnbfZ2VnRPGBADxOmd5aHVrEf5KLw9hkVY2X82kB 6HRTmKqrNGDAewRa4Orv/8oB/v+12M6a0RWAh8KP3TMfUXtvYK7f3l6vUBj2HE5JXmXn U/XA== X-Gm-Message-State: ACrzQf1/Saie54bGZXulS72t4j8jhRHyV7dHkvBKnBFqSaxJrFh8sIPS bSdzWx5ZsyoDZVMpLDXspErcoRHY1xSP+CqE/3c= X-Google-Smtp-Source: AMsMyM6qFcIx5U08ZTH369z2UmkkJitPv6iJnZ0AQABefWLPbZFTjf3IWRVFmMMZnyqBeHDB/nRtgvAuhlkAYpukCZI= X-Received: by 2002:ab0:70c6:0:b0:39e:ed14:806b with SMTP id r6-20020ab070c6000000b0039eed14806bmr933134ual.82.1666997097873; Fri, 28 Oct 2022 15:44:57 -0700 (PDT) MIME-Version: 1.0 References: <5ceebae4-a3fb-5d29-cdb7-dceed7b07c78@wcflabs.de> <02f9fc3b-2972-dfdb-9d76-df120efc73b3@wcflabs.de> In-Reply-To: <02f9fc3b-2972-dfdb-9d76-df120efc73b3@wcflabs.de> Date: Fri, 28 Oct 2022 15:44:46 -0700 Message-ID: To: =?UTF-8?Q?Joshua_R=C3=BCsweg?= Cc: internals@lists.php.net, tim@bastelstu.be Content-Type: multipart/alternative; boundary="000000000000dc450205ec200178" Subject: Re: [PHP-DEV] Re: RFC [Discussion]: Randomizer Additions From: jordan.ledoux@gmail.com (Jordan LeDoux) --000000000000dc450205ec200178 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Oct 28, 2022 at 12:23 PM Joshua R=C3=BCsweg via internals < internals@lists.php.net> wrote: > Hi > > > You can find the RFC at: > > > > https://wiki.php.net/rfc/randomizer_additions > > Tim D=C3=BCsterhus and I have updated the RFC and have broadly adopted th= e > proposals. > > Firstly we have renamed the `getBytesFromAlphabet` to > `getBytesFromString` as Larry Garfield suggested. > > Secondly, we have extended the getFloat method with a parameter that > specifies which type of interval should be generated (Open, Closed, > Right Half-Open and Left Half-Open). > > Are you happy with the enum names? Have you any other suggestions? > > I had a discussion with Tim about this naming topic as well, and want to convey my suggestion along with the reasoning. I think the enum should be `Random\IntervalBoundary` with the enum cases: `IntervalBoundary::Open` `IntervalBoundary::Closed` `IntervalBoundary::OpenRight` or `IntervalBoundary::HalfOpenRight` `IntervalBoundary::OpenLeft` or `IntervalBoundary::HalfOpenLeft` First, I think the enum should be `IntervalBoundary` because an enum is used to explicitly represent a program state in a human readable format. Because of this, I think that the readability for enums should be the highest priority, even above brevity. Additionally, it should describe the thing that has the properties, in this case the interval itself. These interval settings are *not* a property of floats, it's just that interval boundary types don't usually matter outside of floats. The enum should be in the `Random\` namespace, because we are only guaranteeing that this is a complete list of interval boundary properties in the domain of random numbers. It should not be in the `Random\Randomizer` namespace, even though that's the only place it would be used, because these properties of an interval boundary would be shared by anything that has interval properties in the domain of random numbers. Enums don't describe a hierarchy, like interfaces do, so it doesn't make sense to me to do it the same way the engines are done, for example. I think `OpenRight` and `OpenLeft` are clear enough, since it clearly describes something that is only half open, but I wouldn't argue strongly against `HalfOpenRight` and `HalfOpenLeft` if someone else felt strongly about it. Anyway, that's my notes. :) Jordan --000000000000dc450205ec200178--