Re: RFC [Discussion]: Randomizer Additions
| From: | Larry Garfield | Date: | Tue, 18 Oct 2022 19:50:02 +0000 |
| Subject: | Re: RFC [Discussion]: Randomizer Additions | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-118845@lists.php.net to get a copy of this message | ||
On Tue, Oct 18, 2022, at 12:22 PM, Tim Düsterhus wrote:
>>> Generating a random string containing specific characters...thus requires multiple
>>> lines of code for what effectively is a very simple operation.
>>
>> Yeah, though those lines of code add distinction and emphasis for is
>> meant by character.
>>
>> In particular, users might be surprised when they give this string
>> "abc😋👨👩👦"* and get a non-ascii result.
>
> That's why the method includes 'bytes' in its name. This term is also
> used in ->shuffleBytes() which was renamed in
> https://wiki.php.net/rfc/random_extension_improvement due to
> this exact
> problem.
>
> In fact ->shuffleBytes() can be considered the companion method to the
> proposed ->getBytesFromAlphabet():
"Alphabet" here still, to me, implies a character set, not a byte stream.. Maybe
getBytesFromString? getBytesFromList? getBytesFrom() (because you're getting it
"from" the string that's provided, so you don't need another noun there.)?
I'm not opposed to the functionality, but "alphabet" doesn't seem like the right
word for it.
--Larry Garfield