<div dir="ltr"><div>I like the idea.</div><div><br></div><div>I think I'd be using typealias a lot to make things more concise, but that's not necessarily a problem. </div><div><br></div><div>How would I name the following parameter?</div><div><br></div><div><font face="monospace, monospace"> struct OrderedCollection<T: Comparable> {</font></div><div><font face="monospace, monospace"> }</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">As I understand it, would I do it as follows?</font></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace"> struct OrderedCollection<Element: T: Comparable> {</font></div><div><font face="monospace, monospace"> }</font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">Or would all type constraints now require `where`, like this:</font></div><div><div><div><font face="monospace, monospace"> struct OrderedCollection<Element: T where T: Comparable> {</font></div><div><font face="monospace, monospace"> }</font></div></div></div><div><br></div><div>Also, a typealias seems somewhat redundant when the parameter is labelled:</div><div><br></div><div><div><font face="monospace, monospace"> struct OrderedCollection<Element: T where T: Comparable> {</font></div><div><font face="monospace, monospace"> typealias Element = T</font></div><div><font face="monospace, monospace"> }</font></div></div><div><br></div><div>I wonder if the typealias could be implied.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 24, 2016 at 9:52 AM, Dave Abrahams via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
on Sat Jan 23 2016, David Sweeris <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
<br>
> The title seems fairly self-explanatory. Does anyone else think this could be useful?<br>
> struct True : BooleanType {…} // Just part of the example… not in the proposal (although I do like it)<br>
> struct False : BooleanType {…} // Same<br>
> // This is where the actual idea starts<br>
> struct BigInt <BaseType: T = Int, CanEqualZero: U = Yes where T: IntegerArithmeticType, U: BooleanType> {…}<br>
><br>
> The first parameter label could be skipped (or not), depending on<br>
> whatever the rules for functions parameter labels ends up being<br>
> (either way, they should be the same IMHO). Then variables could be<br>
> declared like this:<br>
> let foo = BigInt() // BigInt<Int, No>()<br>
> let bar = BigInt<Int32>() // For when your data will be processed on a 32-bit platform or something<br>
> let divisor = BigInt<CanEqualZero: False>()<br>
><br>
> (The obvious follow-up suggestion is to then allow a generic type’s<br>
> definition to change based on the results of logical operations<br>
> performed purely on the types that are passed in, but I think that’s<br>
> getting into “macro system” territory, and should probably be its own<br>
> thing.)<br>
><br>
> Anyway, thoughts?<br>
><br>
<br>
</span>+1<br>
<span class="HOEnZb"><font color="#888888">--<br>
-Dave<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</font></span></blockquote></div><br></div>