News for hackers. Stuff that matters.
Re:Porting Graphing Calculator from C++ to Swift by snovv_crash on Saturday July 02, 2022 @02:23PM (#31961166)
I wonder how a rewrite of the core algorithms in modern C++ and a Swift wrapper + UI would have compared. This also would have allowed easy porting of the core to other platforms.
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.
Re:Porting Graphing Calculator from C++ to Swift by danappelxx on Saturday July 02, 2022 @03:10PM (#31961491)
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++

Re:Porting Graphing Calculator from C++ to Swift by socialdemocrat on Sunday July 03, 2022 @10:52AM (#31968145)
Swift is portable to other platforms. Not the UI but core logic in Swift would have been portable. Swift can be exposed as C APIs.