2 Jul 2025 |
Katalin 🔪 | well, they do have availability annotations, so in theory it would be possible to write libraries that strip themselves down when certain features are unavailable. I have no idea how feasible this is though | 14:20:40 |
Katalin 🔪 | but yeah it’s something that would have to be explicitly done and most people just wouldn't | 14:21:10 |
Randy Eckenrode | In reply to @emilazy:matrix.org do Swift language versions interoperate? Yes. | 14:40:26 |
Randy Eckenrode | In reply to @saiko:knifepoint.net
Swift Concurrency Partial, experimental (basics of actors and tasks work in single-threaded concurrency mode)
👀
Yeah, this is what I was thinking of. That’s (more or less) what you would be doing with Rust in an environment like that. | 14:43:06 |
Randy Eckenrode | In reply to @saiko:knifepoint.net
Swift Concurrency Partial, experimental (basics of actors and tasks work in single-threaded concurrency mode)
👀
* | 14:43:21 |
Randy Eckenrode | In reply to @emilazy:matrix.org where the ergonomics are likely to be bad and ecosystem support nonexistent Does D support no-GC types? Swift has value types and move-only in the core language. The no-allocation subset is banning the types that allocate, which doesn’t seem like the same thing. | 14:45:54 |
Randy Eckenrode | In reply to @emilazy:matrix.org where the ergonomics are likely to be bad and ecosystem support nonexistent * Does D support no-GC types?
Swift has value types and move-only in the core language. The no-allocation subset is banning the types that allocate, which doesn’t seem like the same thing.
| 14:46:06 |
Randy Eckenrode | In reply to @saiko:knifepoint.net since the main ecosystem uses Foundation and Foundation is huge (and tbh I like that it is), yeah makes sense This is a problem for non-embedded as well. Until Apple rewrote it and shared the implementation across platforms, Foundation on Linux and Darwin were different and not always compatible. (Never mind those who want to use platform APIs without caring about portability.) | 14:47:58 |
Randy Eckenrode | In reply to @reckenrode:matrix.org Does D support no-GC types? Swift has value types and move-only in the core language. The no-allocation subset is banning the types that allocate, which doesn’t seem like the same thing. It’s like saying you can’t use Box or Rc in embedded Rust. A crate that uses those obviously won’t be usable in that case. | 14:49:10 |
Randy Eckenrode | That’s not saying Swift packages are going to be good about avoiding classes when they don’t need to use them. They probably have some work to do if they want to avoid allocations, which is good even in non-embedded to avoid unnecessary ref-counting. | 14:51:08 |
Randy Eckenrode | But Swift Embedded is still pretty new. Apple is using it for firmware, but they’ve not said anything about that experience other than that are. We’ll have to wait and see how things play out and whether Swift turns into a viable language for that purpose. | 14:54:05 |
Randy Eckenrode | Swift is also getting a WASM target. I’m going to have to package that too. 😭 | 14:55:30 |
Randy Eckenrode | There’s an opportunity for Nix to establish itself as the way to build Swift applications for these targets, but we’ve got ~no maintainers to do it. | 14:56:23 |
Randy Eckenrode | * | 14:58:06 |
Randy Eckenrode | * | 14:58:22 |
Zhaofeng Li | well, you can, if you implement the allocator interface everything from alloc will become usable. the cool thing about Rust is that it's all done on the library level and there's little compiler magic involved | 17:03:08 |
Zhaofeng Li | by the way, is there a way to inspect the swift interfaces generated from -import-objc-header ? | 17:22:51 |
Zhaofeng Li | all the automatic rewriting from - (void)dostuffWithCompletionHandler:(void (^)(Stuff *))completion; to doStuff(_ withCompletion:) is just too... magical (in a bad way) | 17:22:57 |
Zhaofeng Li | and depending on the parameter naming and type, sometimes Swift will automatically give you an async func, sometimes not | 17:23:52 |
Zhaofeng Li | also https://developer.apple.com/documentation/swift/calling-objective-c-apis-asynchronously does not tell the whole truth - I have a method that meets all requirements there yet swift does not automatically give me an async version 🤷♂️ | 17:25:53 |
Randy Eckenrode | Is it being throw off by the Handler in the name? | 19:22:38 |
Randy Eckenrode | * Is it being thrown off by the Handler in the name? | 19:22:46 |
Randy Eckenrode | Oh, got to the part of the documentation where that should work. | 19:23:52 |
Randy Eckenrode | * | 19:24:04 |
Zhaofeng Li | Yeah, a bit confused at the behavior that I still don't totally get. The end result looks nice and Swift-y but I really dislike the magical aspect of it | 19:30:01 |
Katalin 🔪 | I’m pretty sure there are annotations to manually set the imported name but I can’t find them right now | 20:45:23 |
Zhaofeng Li | name is one issue, but it's also annoying not to have the async variants automatically implemented for me sometimes | 20:46:50 |
Zhaofeng Li | ... and not have a way to know when/why it happens 🙃 | 20:48:04 |
Katalin 🔪 | aha https://forums.swift.org/t/concurrency-interoperability-with-objective-c/41616#additional-objective-c-attributes-10 | 20:48:55 |