[swift-evolution] [Review] SE-0065 A New Model for Collections and Indices

Dmitri Gribenko gribozavr at gmail.com
Mon Apr 11 11:20:52 CDT 2016


Hi,

On Mon, Apr 11, 2016 at 9:16 AM, Gwendal Roué <swift-evolution at swift.org> wrote:
> Will it still be possible with the new protocol and types? Especially, how to I generate "BETWEEN 0 AND 17" from 0..<18 without a supporting collection that gives me the predecessor of 18?

You would either design your API to accept a CountableRange, or a
Range where Bound conforms to Strideable.

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 <gribozavr at gmail.com>*/


More information about the swift-evolution mailing list