News for hackers. Stuff that matters.
Re:What's Going Down at the Tiobe Index? Swift, Surprisingly by mamcx on Saturday April 27, 2019 @06:24PM (#19768005)
- Optional is a nuisance.. People are going to fiddle with ? and !

And that is GOOD. This mean that wrong code look wrong:

https://www.joelonsoftware.com/2005/05/11/making-wrong-code-...

and many instances of it mean something is badly wrong in the codebase, and the developer(s) haven't adapted to how must be done.

In contrast:

    bad.shit.happends
Good look with that...

- "let" is a mess

Overloading keywords have problems, but in this case the rules are simple. And is not that many context to worry about.

- I would much rather have = mean assignment

Agree. Overloading keywords are fishy, but operators are in another league!

Have some sense for maths but in other contexts is not worth the extra "feature".

- Reference counting is a bad compromise

You mean, ARC. Is not exactly the same, and the compromise is totally worth. I work with .NET for iOS/android and man, is heavy.

All is about what is default.

With GC, by default, eat memory and unpredictable destructors. With (A)rc only need to worry about break cycles. That not happened often enough to be a real problem

BTW, I have use obj-c, pascal, .net, python, rust. The ARC model is the best for most kind of code most do. I honestly have more unpredictable and unfixable problems with GC (mostly on android with underpowered devices), so I prefer to get something less automatic..

Re:What's Going Down at the Tiobe Index? Swift, Surprisingly by ken on Sunday April 28, 2019 @10:16AM (#19771239)
> [Using Optional] mean that wrong code look wrong

...as long as you don’t use any implicitly unwrapped optionals (which virtually all Mac/iOS code does), or use any frameworks that predate Swift (like AppLit/UIKit/Foundation), or wrap any C libraries (most third-party libraries in the world).

So basically that’s true for the 5-line samples showing how cool Optional is, and no real program I’ve ever written. It was a nice experiment but in practice I have more issues stemming from Optional than I ever did with nil.

> In contrast: bad.shit.happends

Do you not read any Swift forums? There are newbies posting every single day asking why "a.b.c" crashed in Swift.

Re:What's Going Down at the Tiobe Index? Swift, Surprisingly by mamcx on Sunday April 28, 2019 @12:05PM (#19771862)
> There are newbies posting every single day asking why "a.b.c" crashed in Swift.

That is fair. And totally show why optionals are the right thing. Because obj-c and others NOT have it the world suck MUCH more. That is why nulls are the billon dollar MISTAKE with capital letters.

The solution is to more and more languages, libraries and frameworks embrace the idea of algebraic types, not just declare "interfacing with old codebases with this huge MISTAKE is not nice, so why bother??".

What rust make nice is declare stuff as UNSAFE. I wish this was the case with swift and obj-c so make clear to everyone that you have entered the realm of nasty things and must be more careful...

Re:What's Going Down at the Tiobe Index? Swift, Surprisingly by wool_gather on Sunday April 28, 2019 @03:58PM (#19773320)
Objective-C has "optionals": every object pointer can be `nil`. What it gets right is that it doesn't implicitly treat a `nil` as a logic failure.
Re:What's Going Down at the Tiobe Index? Swift, Surprisingly by mamcx on Sunday April 28, 2019 @05:17PM (#19773741)
That is not optionals, at all.