[swift-evolution] [Proposal] Random Unification

Letanyan Arumugam letanyan.a at gmail.com
Mon Jan 8 16:16:42 CST 2018


> On 08 Jan 2018, at 21:02, Nate Cook via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I created a playground to explore this question, starting with a minimal subset of the proposal’s additions and building from there. The attached playground demonstrates what’s possible with this subset on the first page, then uses subsequent pages to explore how the main random facilities of the C++ STL work under this model. (In my opinion, they work pretty well!)
> 
> The subset in the playground has three main differences from the proposal:
>  - It doesn't include a Randomizable protocol or a random property on numeric types.
>  - It doesn't include the static random(in:) methods on numeric types, either.
>  - The RandomNumberGenerator protocol doesn't have an associated type. Instead, it requires all conforming types to produce UInt64 values.
> 
> I’ve tried to include a bit of real-world usage in the playground to demonstrate what writing code would look like with these additions. Please take a look!
> 
> Nate


+1 to this design

Just my 2 cents but this looks very simple and easy to use due to being very consistent. I also like that Randomizable was dropped as I feel it doesn’t hold its weight.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20180109/369dfc26/attachment.html>


More information about the swift-evolution mailing list