On Sun, Apr 17, 2016 at 11:14 PM, Thorsten Seitz <tseit...@icloud.com> wrote: > Preventing indices of one collection being used by another collection can be > done by using path dependent types like in Scala. > > Then 'i' would have type a.Index (where 'a' is the instance!) and therefore > b[i] would not typecheck as it would require an index of type b.Index
This is an interesting concept! Would this work with slices? You should be able to use indices from slices with the base collection, and vice-versa (when indices are in range). 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-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution