3 ms·
I've recently been re-writing an old pet project from Objective-C to Swift. I've found the Swift error messages incredibly unhelpful in Xcode compared to Object
by Osmium 12y ago
I've recently been re-writing an old pet project from Objective-C to Swift. I've found the Swift error messages incredibly unhelpful in Xcode compared to Objective-C, but the resulting code to be a lot more readable and concise (and therefore, importantly, much more maintainable). I find myself writing a lot less 'glue' code too. On balance, I probably found the Objective-C code easier to write, partly because of Xcode support and partly (if I'm honest) because it lets me do more dumb/unsafe things, which should probably be discouraged.
For me at least, the biggest problem I've found is that I have no intuition for best practices in Swift (when to use certain language features etc.), and that makes me wary that I'm writing bad Swift code, even if it's technically correct. I imagine it'll take time for the community to standardise on what makes for good Swift code, and for more extensive learning resources to be developed etc. Sticking to Objective-C for now certainly doesn't seem to be a bad thing.
- pavlov 12y ago... I probably found the Objective-C code easier to write, partly because of Xcode support and partly (if I'm honest) because it lets me do more dumb/unsafe things, which should probably be discouraged. That same argument was used in the '80s by Pascal proponents against C. Would the software we use today be better if it all were written in Pascal instead of C? Yes, there would certainly be less buffer overflow exploits... But also less power and features. C was simply more suited to building complex/powerful software than most other languages at the time. Can you imagine Linux in Pascal? The way I feel about Swift is that it's a better C++ combined with some of the didactic/patronizing aspects of Pascal. That's probably a fine language for some uses, but I wish they had designed a better Objective-C instead.
- orbifold 12y agoThe Linux Philosophy of a kernel that runs on everything from a super computer to a smartphone is sort of misguided I think. You can write much smaller and potentially faster kernels if you focus on one architecture and use case, see for example the Oberon project (it uses a pascal descendant for its system language, also called Oberon) or the Mesa/Cedar system at Xerox Parc. With time I'm sure that kernel designs like the Singularity OS one will take over: Invent a systems programming language that allows for better static analysis and verification of driver protocols. Then run everything at ring 0 and identity mapped virtual address translation, with most of the applications written in memory safe languages or virtualized in app containers. That way context switches, which incur huge overhead, as well as heavy weight processes are a thing of the past.