On Mon, Apr 11, 2016 at 9:20 AM, Dmitri Gribenko <[email protected]> wrote:
> Hi,
>
> On Mon, Apr 11, 2016 at 9:16 AM, Gwendal Roué <[email protected]> 
> 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.

You could also make your API generic over RangeProtocol where Bound
conforms to Strideable, check if the end point is contained in the
range (detecting closed ranges), and if it is not, perform the
adjustment.

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 <[email protected]>*/
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to