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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to