"Not empty" vs "empty, not"

OK, this is a crazy idea and I realize that this is not going to be implemented any time soon. I just want you thoughts about it ;)

In Kotlin M12, isNotEmpty has been deprecated in favour of isEmpty().not(). Broadly all methods named isNotSomething have been deprecated in favour of isSomething.not().

I totally get it : maintaining those functions whould force maintainers to maintain a duplicate of each function that returns a boolean, adds boilerplate code and a lot of Java libraries that we use everyday are not using this convention so the new way is compatible with any method that returns a boolean.
It’s a total win, except that I liked and used the method isNotEmpty() a lot.

And, maybe it’s just be, but I find :

if (list.isNotEmpty()) {}

To be a lot more readable than :

if (list.isEmpty().not()) {}


Just semantically, when you read it, the first is a state (not empty) while the other is a state that is then inverted (empty, not) and when I read it, I mentally needs more… neurons ?

So how about something like :

if (list.not:isEmpty()) {}


(Please remember that this proposal is a thought experiment, don’t go red yet :p)

This syntax would allow to call no-argument extension functions.
I’d limit this to extension functions to prevent abuses like

let name = db.getFirstName:getUser(“salomon”)

Which would be horrifying :wink:

Once again I realize that Kotlin is closed to release and that it will certainly NOT be implemented, I’d just wanted to… share my frustration with this new .not() syntax :wink:

So, what do you think ?

Wait, where did you get the information that isNotEmpty() is deprecated? It's not deprecated in M12 and we have no plans to deprecate it in 1.0, as far as I know.