[swift-evolution] [Review] SE-0065 A New Model for Collections and Indices
Dmitri Gribenko
gribozavr at gmail.com
Mon Apr 18 01:16:07 CDT 2016
On Sun, Apr 17, 2016 at 11:14 PM, Thorsten Seitz <tseitz42 at 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 <gribozavr at gmail.com>*/
More information about the swift-evolution
mailing list