Polemic (?) Thoughts

I don't know if this is the right form or the right place. But I have to get rid of my thoughts. Sorry for that.

Swift is a wonderful, dynamic programming language. I am far from fully mastering this language and the paradigms behind it. But I still encounter problems during my daily work that make working with Swift very frustrating.
Especially the work with generic types. I explained this in detail Impossible to build....
Generics were a major reason for me to switch from ObjC to Swift.

Swift is being evolved at a great pace and new, really great features are being added all the time. I think that's what makes a dynamic language.
But a language and its tools that claims to be usable in any scenario must also be stable and reliable. It doesn't make sense to use a language where you have to be afraid with every new version that a project will still be compiled or compiled in an acceptable time.

After updating to Swift 5, I am forced to "simplify" hundreds of generic expressions of the type
sum = sum + (tom * C2 / (n * 36 * z * z6))
I know that the problem has to do with type checking. Only this knowledge doesn't help me because I can't solve the problem.

I know. That is polemic. But shouldn't you first of all make the base of the language usable in a way you can work with?
Unfortunately, I have the impression that the Swift team is always adding new, super cool features, but forgets to maintain the substructure accordingly.

As I said. That may be polemic, but as a "normal" developer I feel that way.

I want to solve problems with Swift as a tool. I do not want to solve problems that arise through Swift.

I don't want this to be understood as an "attack" on the Swift team. All in all, I love Swift. :smiling_face_with_three_hearts:

2 Likes

Most of the time, problems involving type checking can be solved by reducing usage of type inference. By explicitly typing the variables involved in the expression, you greatly reduce the type checker work.

1 Like

Every variable is already explicitly typed. The given example reads actually:

var sum: T
// loop
sum = sum + (tom * C2 / (n * 36 * z * z6))

It might be polemic, but you're completely right. I feel the same frustration. Every Swift updates brings new compiler bugs, especially on Linux, for example the compiler hogging tons of memory or new expressions not being able to typecheck. Which would be fine, if you could just go and fix them, but if those expressions are in your dependencies, you first need to make a fork and deal with code that you didn't write. And let's not even start with the fact that Swift is only available for (certain versions of) Ubuntu out of the box, and isn't even distributed in the ordinary way (i.e. as a .deb package), but just as a raw binary.

By now, I just accept that Linux support isn't a priority for the Core team.

4 Likes