Earlier quoted context omitted.
It’s not puke inducing, but it is verbose. The language designers just took a different approach to how to write code. Just for some background, it came out at a similar time to c++. Both were designed to be a ‘better c’
Interestingly, Objective-C was not at all designed to be a "better C", it was designed to be, roughly speaking, a more practically useful Smalltalk. This is all laid out in great detail in the wonderful Object Oriented Programming: an Evolutionary Approach .
Bringing Objective-C to the Amiga
81–90 of 113 posts
Re: Bringing Objective-C to the Amiga
#82Earlier quoted context omitted.
Compile times are not a temporary problem, they are fundamental. Yes, they can fix some of the more egregious specific problems, but the model they have chosen is inherently expensive to compile as it leans so much on the compiler. And they no longer have Mr. Moore to bail them out by mere passage of time. In fact, last I checked the compiler has actually gotten slower, overall, in recent versions.
Could you provide a documentation on the compiler model of Swift, and why it would be slower? How can that model be compared to clang's c++ compiler model?
Doing a lot of work takes more time than doing less work.
There was an interview/article a while back that explained this for C++/D, I think it might have even been by Walter Bright himself, that explained this really well. Sadly, I can't find it right now.
In essence, C++ is predicated on the compiler being able to see through any abstractions you might have provided at compile time, in order to be able to optimize that away. That means you effectively lose separate compilation, because the compiler has to look at the implementation of dependencies, not just at their interfaces. Transitively.
So C++ is a lot slower to compile than C/Objective-C, and Swift is very similar, it just doubles down on that model. With this model it doesn't come as a surprise that compiling everything at once is often massively quicker than compiling single source files, the "whole module optimization without optimization" thing.
I also think there's at least some polynomial factor involved here, so as your projects get bigger, per-file compile times get significantly slower.
C and Objective-C really take separate compilation to heart, so you don't run into nearly the same problems (though: header files :-( ). Go is a more modern take on this, compile times are legendary.
In addition to that, Swift leans extremely heavily on the optimizer to get common constructs to execute in reasonable time, rather than 100x or more slower than you'd expect. That also costs. A lot. tcc doesn't really optimize much, it's a good example of how fast a C compile can go. (I clocked it at several hundred thousand lines of code per second or more, for comparison, numbers from a Swift project were 60 lines of code per second).
And last not least there's pretty wild forward/backward type inference, which will happily go exponential. For example, let's look at the following code:
let a:[Int] = [1] + [2] + [3] + [4] + [5] + [6]
This actually used to fail with "expression too complex", nowadays it compiles in 26 seconds on my machine, and adding one more integer array gets it to fail again, after 59 seconds. Hmmm...Re: Bringing Objective-C to the Amiga
#83Does anyone else look at Objective-C code, and just want to puke?
Re: Bringing Objective-C to the Amiga
#84Earlier quoted context omitted.
Interestingly, Objective-C was not at all designed to be a "better C", it was designed to be, roughly speaking, a more practically useful Smalltalk. This is all laid out in great detail in the wonderful Object Oriented Programming: an Evolutionary Approach .
Ah my bad, I misremembered a talk I heard once. I'll check out the book. Thanks.
Re: Bringing Objective-C to the Amiga
#85Earlier quoted context omitted.
> drop a bunch of autoreleases And add a bunch of allocs, which I find less useful because they don't really communicate intent, whereas the autoreleases usually do. Also, in my code-base, autoreleases are less than 0.5% of the total code, and that includes a lot of legacy code. In fact, after creating a macro for creating class-side convenience creation methods along with initializers in one go, I could probably dro…
> Yes, that's the excuse. It's a bad excuse. I'm amazed that you find this to be a bad excuse, since it's what all optimizing compilers rely on to produce performant code. > I've not found ARC code to crash less, and if you remember the article, it is about code that cannot possible crash actually crashing due to ARC. The code crashes because you violated an invariant at some point of program execution. The way the C…
Yes, I am aware that that is the excuse. It still is a terrible excuse.
> because you violated an invariant at some point of program execution.
Not true. The code in question is a callback, so my code is getting called by Apple code, and ARC dereferences a pointer it has no business de-referencing.
May I remind you that the code that crashed due to a segfault was
{
return 0;
}
Also, if you think "You have violated something, for which we will give you no diagnostic, and therefore we feel free to crash you at some random other place in the program that has nothing to do with the place where the alleged violation took place, again with no diagnostics" is reasonable...well, could I interest you in purchasing a bridge in New York? Or some Nevada oceanfront real estate?And no, you don't need a "safer" language like Swift, you just need to not go for the crazy modifications the optimizer writers pushed into the C standard.
Re: Bringing Objective-C to the Amiga
#86Earlier quoted context omitted.
I still use manual reference counting :) In John Oliver’s voice : “Fuck you Apple, fuck you.”
This kind of bragging sound just like "I don't read books".
Re: Bringing Objective-C to the Amiga
#87Does anyone else look at Objective-C code, and just want to puke?
No, and if you do, then I suggest you visit a doctor. Rant: Objective-C is a wonderful language, once you learn it properly. There's a lot of Swift fanboiism (is that a word?) and a lot of Objective-C hate. I have an opinion on why. The vast majority of people that used Objective-C were drawn to the success of iOS. They were developers, used to languages like Javascript, Java or C++. Coming to Objective-C, their imme…
I'd like to add a category:
People that are aware of Objective-C's limitations and want(ed) an actual improvement, not the 1 step forward (sort of), 3 steps back that we got. And they were pretty close, even got it in the marketing slogan: Objective-C without the C. Or at least without most of C much of the time. Or some. Instead they consistently doubled down on the things that were the least useful, for example structs. With classes and primitives, structs were always an extra, needed only for backwards compatibility and, historically, performance. What do they double down on? Structs. WTF?
The mix of Smalltalk keyword syntax and C syntax was always a bit of a problem. So let's keep both and make the integration between the two even more awkward!
And so on.
See also Rob Rix's rant:
https://www.quora.com/Which-features-overcomplicate-Swift-Wh...
Crucially, the vast majority of this is incidental complexity, not essential complexity. Swift is a crescendo of special cases stopping just short of the general; the result is complexity in the semantics, complexity in the behaviour (i.e. bugs), and complexity in use (i.e. workarounds).
Note that this is coming from the other side, so someone who doesn't like Objective-C much at all, and even from that perspective, Swift falls short.
Re: Bringing Objective-C to the Amiga
#88Earlier quoted context omitted.
It’s not puke inducing, but it is verbose. The language designers just took a different approach to how to write code. Just for some background, it came out at a similar time to c++. Both were designed to be a ‘better c’
Interestingly, Objective-C was not at all designed to be a "better C", it was designed to be, roughly speaking, a more practically useful Smalltalk. This is all laid out in great detail in the wonderful Object Oriented Programming: an Evolutionary Approach .
Re: Bringing Objective-C to the Amiga
#89Earlier quoted context omitted.
Could you provide a documentation on the compiler model of Swift, and why it would be slower? How can that model be compared to clang's c++ compiler model?
The model for Swift is for the compiler to do a lot of work. Doing a lot of work takes more time than doing less work. There was an interview/article a while back that explained this for C++/D, I think it might have even been by Walter Bright himself, that explained this really well. Sadly, I can't find it right now. In essence, C++ is predicated on the compiler being able to see through any abstractions you might ha…
Re: Bringing Objective-C to the Amiga
#90How can I run Amiga os on sometthing less exotic?
It uses the WinUAE emulator, which you can download for free. (http://www.winuae.net/) You would need to purchase roms to go with this though. The Amiga Forever distro includes roms.
Edit: Shameless plug: I used to run a CNet BBS back in the day and I got back into that scene by setting up another CNet bbs on my virtual Amiga. You can telnet to it at chksmak.cnetbbs.net:2600