SE-0202 Amendment Proposal: Rename Random to DefaultRandomNumberGenerator

I’ve tried to stay as impartial as I could muster in the recap above. More of my opinion here.

It seems one argument behind amendment is that the length of the proposed rename doesn’t matter, because no one should be typing that, which is a result of the core part of SE-0202: to get a number, you should use Int.random(in: 0 ..< 10).

The other argument is that

...which implies that you would have to come across this type somehow, so that it can promote the full breadth of your options by stunning you with it’s impractical length.

If you use logic, you can not have it both ways! One of these two arguments is clearly invalid. But there is a good point about the autocomplete. It’s reasonable to expect that Swift users will discover about the SE-0202 additions this way, which is why maintaining Random in the current form is so important. In addition to being logical future extension point (for users and stdlib alike), it is superior place to house all the relevant documentation than on the RandomNumberGenerator protocol.

I’m assuming that before the release, the :bat::man:—ups, I mean @nnnnnnnn—will come in and fill the Random with examples of rolling you own, well distributed an unbiased, PRNG implementations inside the documentation comment, as is the great Swift tradition. :stuck_out_tongue_winking_eye:

I’m not against the naming discussions per se, but I don’t understand how this amendment made it past the pitch and into the review phase, as I can’t find here any merit beyond bikeshedding. Much more salient naming issue was raised during the amendment pitch:

Learning the lesson from C++, our protocol should be named RandomBitGenerator, to clearly label it as the source of randomness, that is one step removed from the act of generating numbers (done on the numeric types). That should distance the two concepts and address the concern raised earlier:

To reiterate, I see absolutely no “immediate need to rename” Random supported with evidence and logical reasoning. Anyone suggesting this should first demonstrate the harm being done. Next they need to demonstrate how mere renaming avoids said harm. In other words: prove that this is not another bikeshedding session, especially in the light of thorough and very productive pitch phase on SE-0202, where the design evolved quite a bit and cristalized into well though out final accepted proposal! As a personal heuristic, when the “solution” is type name composed of 4 or more words, I suggest you check yourself for unconscious bias... maybe you haven’t yet fully internalized Swift’s naming guidelines (“Omit needles words”) and are just bikeshedding instead of solving a real issue.

2 Likes