<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Dan,<div class=""><br class=""></div><div class="">Thank you for your proposal. This is the right place to start discussion of it. If we want to do this then we would have to make changes in both Darwin and open source versions, to maintain source compatibility.</div><div class=""><br class=""></div><div class="">Out of curiosity, why propose an enum instead of an additional set of typed properties? Looking at the implementation of NSTask, it sure seems like we only expect either a file handle or pipe. I’m not sure if we would ever add another.</div><div class=""><br class=""></div><div class="">- Tony</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 17, 2015, at 11:34 AM, Dan Stenmark via swift-corelibs-dev <<a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">This is my first proposal to swift-corelibs, so I’m not sure how much flexibility we have in terms of deviating from the darwin’s original Foundation definitions. That said, it’s always seemed a little screwy to me that NSTask's standardInput/standardOutput/standardError properties sacrifice any semblance of compile-time type safety by accepting id/AnyObject (which, at run time, must be either NSPipe or NSFileHandle, else it blows up). If allowed, I’d like to take the opportunity to modernize this in the open source version of Foundation.<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">class</span> NSTask : <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">NSObject</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">... <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color: rgb(187, 44, 162);" class="">public</span> <span style="color: rgb(187, 44, 162);" class="">enum</span> IOType {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">case</span> FileHandle(NSFileHandle)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">case</span> Pipe(NSPipe)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""> <span style="color: rgb(187, 44, 162);" class="">public</span> <span style="color: rgb(187, 44, 162);" class="">var</span> standardInput: <span style="color: rgb(79, 129, 135);" class="">NSTask</span>.<span style="color: rgb(79, 129, 135);" class="">IOType</span>?</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">var</span> standardOutput: <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">NSTask</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">IOType</span>?</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">var</span> standardError: <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">NSTask</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">IOType</span>?</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">...</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><br class=""></div><div class="">Dan</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=U7z7oSqRMSwdl2rYt9JJ4zIFaeg4R-2FxExg9xndDuCbzJ4JLi5Gt6tW-2FMOPddk8KHiIg8kfIUnJL-2BVPRrj3-2FS5yDuH54VVgXuaLyDiL-2FEO7RXYCFnCOxQIR0AN0VDvxlHG19J-2FPIj1keT-2BHiW05Ilzp0cl4cMEavPBwPzbJIkstvKkVF-2FzBStdJVoB0g5DLfuRln-2FL7Jhj8emByOMvlmUSOI-2B99WvyeXGR9zasT7qKtM-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<br class="">swift-corelibs-dev mailing list<br class=""><a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-corelibs-dev<br class=""></div></blockquote></div><br class=""></div></body></html>