<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi David,<div class=""><br class=""></div><div class=""><div class="">To add to what I wrote earlier, the design of the Swift is such that adding new features isn’t “hard”, but it does require time and patience because most new features have ripple effects on other parts of the compiler that need to be thought through. Fortunately, the design of the compiler is such that vast majority of those ripple effects will cause a compile time failure. This is why I encouraged you to add new “.def” nodes up front. That’s the good news. The bad news is that you still need to think through the ripple effects and that means developing some minimal design and debugging expertise over the compiler as a whole. If you’re not discouraged by the process, the experience is quite rewarding.</div><div class=""><br class=""></div><div class="">One more tip: if you’re going to add a new language feature, focus first on the type system and writing tests. Once you feel that implications are fully thought through, you can move on to “code gen” (i.e. SILGen and IRGen). If you rush to “code gen” first so that you can play with your shiny new feature, then you’re likely to get frustrated by self-inflicted bugs. You can experience the blissful pre-code-gen world by invoking swift like so: <font face="Courier" class="">swift -frontend -typecheck file.swift</font></div><div class=""><br class=""></div><div class="">Dave</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Aug 29, 2017, at 17:26, David Sweeris &lt;<a href="mailto:davesweeris@mac.com" class="">davesweeris@mac.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I was thinking I'd probably eventually need to muck about with those, but it's good to know that I should start poking around in there sooner rather than later. Thanks!</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Aug 29, 2017, at 11:21 AM, David Zarzycki &lt;<a href="mailto:zarzycki@icloud.com" class="">zarzycki@icloud.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi David,<div class=""><br class=""></div><div class=""><div class="">You’re arguably deep in the weeds. Try starting by adding new nodes to ExprNodes.def and DeclNodes.def and watch what blows up. Once you do that, crib code similar nodes to get your new Expr/Decl nodes to start compiling.</div><div class=""><br class=""></div><div class="">Please also keep in mind that LLVM and derived projects like Swift have custom RTTI logic (which is partly why these “.defs” files exist), and therefore language features like multiple inheritance don’t “just work” like you might expect.</div><div class=""><br class=""></div><div class="">Dave</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On Aug 29, 2017, at 14:04, David Sweeris via swift-dev &lt;<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi everyone! I'm trying to implement literal values as generic types. So far, I've made `LiteralExpr` inherit from both `Expr` <i class="">and</i> `GenericTypeDecl` (instead of just `Expr`), and did whatever other changes were necessary to get that compiling (mostly putting several "using Expr::setImplicit;" kind of lines within `LiteralExpr`'s declaration and prepending "(Expr*)" to a bunch of variables in what are now ambiguous function calls).<div class=""><br class=""></div><div class=""><div class="">Anyway, I haven't done any testing yet to see how much I've broken (compiles != works), but before I get neck-deep in everything I thought I'd ask if anyone sees any fundamental issues with this approach, or has any better ideas.</div></div><div class=""><br class=""></div><div class="">- Dave Sweeris</div></div>_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-dev" class="">https://lists.swift.org/mailman/listinfo/swift-dev</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></body></html>