One exclamation mark instead of two

Hello, do you plan to reduce number of exclamation marks from two to one somewhere in future?
results!.size looks better than results!!.size

Irrespective of the merits of one versus two ! symbols, that ship has sailed over a year ago (with the release of 1.0). I agree that results!.size looks better, and that is precisely the reason why results!!.size is better. The use of !! is ugly code, so it should look ugly.

1 Like

yes, i doubt there is no way to implement results!.size along with results!!.size

I use checkNotNull or requireNotNull :slight_smile:

instead of !! ?

Yes, I prefer IllegalStateException and IllegalArgumentException to NullPointerException.

Obviously I try to avoid each unuseful check.

Otherwise we should require to write result!write

No, we have no such plans. It’s very intentional that !! looks the way it does.

2 Likes

Correct me if I’m wrong, but I believe they went the double route because it’s something you should only do if you’re 100% sure of it. It’s also easier to debug if you have two instead of one.

I have a question, does the compiler support instead of !! because if not it definitely should. Thanks

Then the compiler should also support ᠄ for colons, – and — for minus, → for arrows, etc. Does this sound practical?

No, and having multiple variants for each operator sound like a very stupid idea.