← Back to context

Comment by Jeaye

2 days ago

There are upsides to this approach. Coupling Swift's AST with Clang's AST will allow for the best codgen, for sure.

However, the huge downside to this approach, which cannot be overlooked, is that Clang (not libclang) is not designed to be a library. It doesn't have the backward compatibility of a library. Swift (i.e. Apple) is already deep into developing Clang, and so I'm sure they can afford the cost of keeping up with the breaking changes that happen on every Clang release. For a solo dev, I'm not yet sure this is actually viable, but I will give it more consideration.

However, I think that raising alarms at C++ codegen is unwarranted. As I said before, basically any query builder or codegen takes some form of string generation. The way we make those safe is to add types in front of them, so we're not just formatting user strings into other strings. That's exactly what CppInterOp does, where the types added are Clang QualTypes and Decls.

You right. Always good to remember that Apple was and still is the main company behind LLVM.

Swift was built and its maintained by the same time that worked in LLVM.

And also, Swift has its own fork of LLVM and LLVM has built-in a lot of features designed for swift like calling convention and async transformation.

The amount of features swift has and is releasing at the same time it has its own LLVM version is just not a thing you can do without a lot of money and years of accumulated expertise.

  • > still is the main company behind LLVM.

    lol people really say whatever comes to their mind around here don't they? I'm pretty sure all of the companies associated with these targets would strongly disagree with you

    https://github.com/llvm/llvm-project/tree/main/llvm/lib/Targ...

    • - lol people really say whatever comes to their mind around here don't they?

      Apple literally hired Chris Lattner in 2005 and made a team to work on LLVM. After GNU refused to integrate LLVM into GCC,

      But Apple saw an opportunity to have its own C/C++ compiler.

      To this day, Apple still has one core team working on LLVM.

      Anyone can come in, add a feature/target, and then leave the project. But a of lot LLVM maintainers are hired by or indirectly big tech companies.

> For a solo dev, I'm not yet sure this is actually viable, but I will give it more consideration.

look i'm not trying to shit on your project - i promise - i know calling you out like this publically almost requires a political kind of response (i probably shouldn't have done it). i agree with you that as a solo dev you can't (shouldn't) solve this problem - you have enough on your plate making jank great for your core users (who probably don't really care about cpp).

> As I said before, basically any query builder or codegen takes some form of string generation.

i mean this is a tautology on the level of "everything can be represented as strings". yes that's true but types (as you mention are important) and all i'm arguing is that it's much more robust to start with types and end with types instead of starting with strings and ending with types.

anyway you don't need to keep addressing my complaints - you have enough on your plate.