<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi, Seth. I think you're getting Clang / swift-clang mixed up with swiftc / swift. Clang is not the Swift compiler; the Swift compiler lives in the "swift" repo. Swift depends on Clang for its interoperation with C and Objective-C.</div><div class=""><br class=""></div><div class="">A <i class="">lot</i> of the compiler encodes information about Optional, but most of it stems from ASTContext.h and ASTContext.cpp, which has dedicated entrypoints for getting Optional, Optional.None, and Optional.Some.</div><div class=""><br class=""></div><div class="">Hope this helps,</div><div class="">Jordan</div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 8, 2015, at 17:59 , Seth Friedman via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="white-space:pre-wrap" class="">Hi all,<br class=""><br class="">In Optional.swift in the stdlib, there's a comment that says "The compiler has special knowledge of Optional<Wrapped>, including the fact that it is an enum with cases named 'None' and 'Some'."<br class=""><br class="">What I'm trying to understand is: If I wanted to implement the optional type from scratch, what would be the process I would go through? I've scoured the swift-clang project and can't seem to find any reference to optionals or even Swift explicitly. I discovered nullability attributes and am hypothesizing that an expression of something like "Type?" is somehow mapped to an attribute, but I'm really just stumbling around in the dark.<br class=""><br class="">In terms of what I've tried, I've gone through a lot of the source in the swift-clang lib/Basic and lib/AST directories, and I've read through the "Clang CFE Internals Manual" on the Clang website.<br class=""><br class="">Help is much appreciated!<br class=""><br class="">Thanks in advance,<br class="">Seth</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=ZEz4qHYnXhPr3bBPu-2FxP4tN3HfWKL-2FtJpqkQ0gkOVSBL6HRSS2hzpFojqZUT85ho4HsE-2FB0XLWrcqkyvQBO5xufppQ8uPgxEwiKwgl62G3z1r-2BUiBJC1BXFFOiAgFN8sYiuSJIgxPeG9oDjBYl-2BjYeGhsvoyyj8qwRtpVhGMN6onwcfLODiw-2B-2FRXFdKLIXbuUSf1FU50IqzQBipBXcb37O1Np08nQCz4e4XNzuhG5HY-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="">
_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></div></blockquote></div><br class=""></body></html>