On Fri, Dec 18, 2015 at 1:22 PM, Erica Sadun via swift-users <
swift-users@swift.org> wrote:

> 2. Is there a way to internalize the generator and not make it public? I'd
> ideally like to hide all details except the fact that this is a sequence of
> (Int, Int)
>

You can use AnySequence and AnyGenerator, but they come at a cost of
dynamic dispatch for every call.  In this case, if you want this component
to be suitable for performance-critical code, I would suggest to avoid them
for now.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <griboz...@gmail.com>*/
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to