Absolutely unhinged project I sniped myself into yesterday: A #swift#GDScript transpiler

There's a watcher running in the background that generates the file on the right on save.

Why!?

* I like Swift syntax better.
* GDScript runs everywhere (inc. web browsers for jams) trivially.
* SwiftGodot is awesome, and is honestly the more serious person's choice for using Swift here but I don't like the extra build complexity, this is just a watcher binary with no impact on Godot itself.

The one spark of genius in the madness that I'll credit myself with here was to lean on the LSP for all the type resolution parts.

(Also I'm glad I read Crafting Interpreters a few years ago so that IR and AST are things I know just enough about to get by)

@PadraigOCinneide Love the spirit of it. I haven’t tried SwiftGodot yet, but it does look a bit complex (but I do want to use Swift!).

I’m curious what sort of things this transpiler saves you from; and what sort of limitations it has, but at this point I’m assigning you an essay haha

@Cykelero Ha, I’m still figuring most of that out. At the moment it means I can write code in the more expressive syntax, with enums, guards, complex switch statements, extensions. I still have to figure out collections, and don’t know how far I’ll go with protocols and generics. I won’t touch concurrency.

I’ll rewrite one of my games with it and see if it’s actually useful or too much goofing around.

@Cykelero I’m only avoiding SwiftGodot until the wasm story is figured out for web exports. My path to making commercial games passes through many game jams and they need web versions. It’s been inching closer and might be less than a year out.

If you wanted to make Mac or iOS games in swift I think SwiftGodot the right thing and we’re lucky to have it. (❤️ @Migueldeicaza)

@PadraigOCinneide That’s really cool! Wherever you end up, the idea of a lighter alternative to SwiftGodot is nice. The escape hatch of being able to keep the transpile GDScript code feels comfortable, too.

@PadraigOCinneide Fascinating! Is there an advantage to this instead of using Swift directly?

EDIT: Just saw the other posts. So never mind 😅