Re:Porting Graphing Calculator from C++ to Swift
by KerrAvon on Saturday July 02, 2022 @02:34PM
(#31961248)
Very difficult to do that in practice, because there’s currently no way to bridge C++ directly to Swift. You could bridge it via C, but any reasonable implementation would have to severely limit the amount of direct Swift interaction with the core code, or you’d be spending infinite time maintaining the bridge.
[ Parent
| on HN ]
Re:Porting Graphing Calculator from C++ to Swift
by danappelxx on Saturday July 02, 2022 @03:10PM
(#31961491)
There’s partial support which is under active development.
https://github.com/apple/swift/tree/main/docs/CppInteroperab...
https://forums.swift.org/t/swift-and-c-interoperability-work...
Re:Porting Graphing Calculator from C++ to Swift
by avitzur on Saturday July 02, 2022 @02:45PM
(#31961333)
Yes, precisely. I looked into bridging to C++ initially, but it was impractical.
Re:Porting Graphing Calculator from C++ to Swift
by boulos on Saturday July 02, 2022 @11:32PM
(#31964803)
Was it in C++ originally not C? (It seems like a C FFI bridge would have been straightforward from). Or did it already go from C => Objective-C++ a while back?
(I read the article hours ago and didn't notice you'd posted. Btw, I think we would have gotten better conversation if you had said "Hey, this is me! AMA" as a top-level comment)
Re:Porting Graphing Calculator from C++ to Swift
by avitzur on Sunday July 03, 2022 @12:47AM
(#31965147)
It has been in continuous development since 1985. Before the port, parts were in C, C++, Objective-C, and Objective-C++, as well as Lex, Yacc, GLSL, and Python. Will do the top-level comment.
Re:Porting Graphing Calculator from C++ to Swift
by omar0226 on Saturday July 02, 2022 @02:45PM
(#31961329)
Actually C++ could be bridged thru Objective-C++ which at the same time can be bridged to Swift. A little bit manual, but possible
Re:Porting Graphing Calculator from C++ to Swift
by aaaaaaaaaaab on Saturday July 02, 2022 @07:06PM
(#31963323)
>You could bridge it via C
*Objective-C++