[swift-dev] Advice for implementing "literal values as generic types"

David Sweeris davesweeris at mac.com
Tue Aug 29 16:26:31 CDT 2017


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!

> On Aug 29, 2017, at 11:21 AM, David Zarzycki <zarzycki at icloud.com> wrote:
> 
> Hi David,
> 
> 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.
> 
> 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.
> 
> Dave
> 
> 
>> On Aug 29, 2017, at 14:04, David Sweeris via swift-dev <swift-dev at swift.org <mailto:swift-dev at swift.org>> wrote:
>> 
>> Hi everyone! I'm trying to implement literal values as generic types. So far, I've made `LiteralExpr` inherit from both `Expr` and `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).
>> 
>> 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.
>> 
>> - Dave Sweeris
>> _______________________________________________
>> swift-dev mailing list
>> swift-dev at swift.org <mailto:swift-dev at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-dev
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170829/7c229409/attachment.html>


More information about the swift-dev mailing list