Re: [VOTE] Random Extension Improvement

From: Date: Fri, 15 Jul 2022 16:02:02 +0000
Subject: Re: [VOTE] Random Extension Improvement
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-118266@lists.php.net to get a copy of this message
2022年7月14日(木) 16:14 Claude Pache <claude.pache@gmail.com>: > > > > Le 14 juil. 2022 à 06:32, Guilliam Xavier <guilliam.xavier@gmail.com> a > écrit : > > > > On Thursday, July 14, 2022, Go Kudo <g-kudo@colopl.co.jp> wrote: > > > >> 2022年7月13日(水) 1:10 Tim Düsterhus <tim@bastelstu.be>: > >> > >>> Hi > >>> > >>> On 7/12/22 18:04, Tim Düsterhus wrote: > >>>> I also think that both '$string' and '$binary' are > >>>> appropriate > parameter > >>>> names in this case, so particular preference from my side. > >>> > >>> Sorry for the follow-up, there's two mistakes in that sentence. It > >>> should read: > >>> > >>> I also think that both '$string' and **'$bytes'** are > >>> appropriate > >>> parameter names in this case, so **no** particular preference from my > >>> side. > >>> > >>> Best regards > >>> Tim Düsterhus > >>> > >> > >> Hi > >> > >> I agree with you. I will change the parameter name from > >> $string to > >> $bytes as I don't see any problem. > >> > >> I will try to explain the changes more rigorously in future proposals. > >> Thank you. > >> > >> Regards, > >> Go Kudo > >> > > > > Hi, > > > > I was waiting for more opinions but... so here's mine: > > > > I would prefer to keep "$string", as [that's how I read the RFCs, and] > when > > calling e.g. shuffleBytes('foobar') I don't feel like I'm passing > > "bytes" > > (or "a binary") but a string (to be shuffled byte-wise rather than > > character-wise or codepoint-wise, but that's from the function, not the > > argument)... > > Granted, not compelling, and probably won't matter in practice, but hey > ;) > > > > Regards > > > > PS: sent from mobile > > > > > > -- > > Guilliam Xavier > > I agree with Guilliam: this function is about «shuffling the bytes of the > given string» (as opposed to, say, «array of ints») > > As precedent, there are bin2hex($string) and > md5($string), which are > unambiguously working with bytes from data given in the form of string, > where «string» is a PHP type, which can hold data that is not necessarily > UTF-8-encoded or Shift-JIS-encoded text. > > —Claude > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > Thanks for the input. This is certainly something to consider. For example, what about the $binaryString argument name? I think it is clearer. I have adopted this as the name of the internal API: php_binary_string_shuffle(). As stated in the GitHub PR, this implementation probably requires additional changes. After voting on the current RFC is complete, we will again send an email to the ML. Regards, Go Kudo

« previous php.internals (#118266) next »