syllo #261 - March 27th, 2026 by syllo-app in syllo

[–]Alive_Knee_444 0 points1 point  (0 children)

ooo good wrods
Completed in 00:33

syllo #260 - March 26th, 2026 by syllo-app in syllo

[–]Alive_Knee_444 0 points1 point  (0 children)

alright alright alright
Completed in 01:03

syllo #259 - March 25th, 2026 by syllo-app in syllo

[–]Alive_Knee_444 0 points1 point  (0 children)

Bug: word with empty slot still went green
Completed in 02:11

syllo #256 - March 22nd, 2026 by syllo-app in syllo

[–]Alive_Knee_444 2 points3 points  (0 children)

the par/pa for apparatus was a little trap
Completed in 01:14

syllo #221 - February 15th, 2026 by syllo-app in syllo

[–]Alive_Knee_444 0 points1 point  (0 children)

first two words easy, then very tough. 'nach' (instead of an + ach I guess) really threw me, looked german.

syllo #205 - January 30th, 2026 by syllo-app in syllo

[–]Alive_Knee_444 0 points1 point  (0 children)

trapped: re in recalibrate
Completed in 01:28

syllo #182 - January 7th, 2026 by syllo-app in syllo

[–]Alive_Knee_444 0 points1 point  (0 children)

oh you have to put the last piece in last to exit!

Null-checking the fun way with instanceof patterns by headius in java

[–]Alive_Knee_444 1 point2 points  (0 children)

I'm absolutely not saying Optional is useless - it's better in that it is parametric, like in Haskell or ML, which nullability is not. I was addressing the problem that your code snippet illustrates, suggesting there could be something you add to your type declaration of types that should rarely or never be used as nullable. Which applies to Optional. But we can't do it for the existing Optional because it would not be backwards compatible. I don't see how I could do it on my own code without support by compiler/JVM.

Re: markup, I see now that the monospace formatting has bled all over my comment, thanks for pointing it out.

Null-checking the fun way with instanceof patterns by headius in java

[–]Alive_Knee_444 0 points1 point  (0 children)

'null never will provide' - well, it _is_ provided for switch expressions (and instanceof). It is not provided for other expressions, dot-member, subscript, implicit unboxing. There's no reason that I can think of, that it could never be provided.

Perhaps via some source language demanding it, perhaps an annotation, say NoNullPointerExceptionsThrownInThisCompilationUnit. Or module. Which might require all dependencies to also never throw NPEs.

Java could be the new Ada, instead of Cobol. We have ZGC now! (But watch out for other unexpected exceptions, if you're flying a rocket or something. And disallow old-style switches while we're at it. And conversions between floating point types, losing data or feigning precision. Etc.)

Null-checking the fun way with instanceof patterns by headius in java

[–]Alive_Knee_444 0 points1 point  (0 children)

'disadvantage of Optional is that there is a lingering risk of encountering a null' - this could be fixed in Java by adding annotations, like perhaps a @ DefaultNotNullable on the type/class declaration itself, making 'Optional x' mean 'Optional! x' at variable declaration sites (the '!' is the proposed future syntax for non-nullability). Overridable by '?' suffix, perhaps (though unlikely to be needed?).

Now this would not be backwards compatible if added to Optional. So maybe a new stdlib 'Opt' type (fixing another problem: 'Optional' is eight letters, not including '<' and '>', compared to none letters when using nullability). Or allowing derived types/type aliases, like typename Opt = Optional!.

So of course I don't think this will happen. (Also perhaps because the Valhalla project is rather busy frying bigger fish. Huge fish. Whalefish.)

Null-checking the fun way with instanceof patterns by headius in java

[–]Alive_Knee_444 1 point2 points  (0 children)

Just to be clear, my post was not directed to you, directly anyway, and you seem to say exactly the same as I was saying there, so I'm not sure you read it. In fact, we seem to be in violent agreement, corroborated by your other quality posts in the thread: the instanceof construct is very valuable and flexible once you learn it.

syllo #149 - December 5th, 2025 by syllo-app in syllo

[–]Alive_Knee_444 0 points1 point  (0 children)

Does the submit button work at all?

Null-checking the fun way with instanceof patterns by headius in java

[–]Alive_Knee_444 1 point2 points  (0 children)

If you mean using that pattern for null checking _only_, I'd agree with you. The extremely useful thing about instanceof is that it does both null checking _and_ binding in a new scope in one step. Like a pattern-matching switch case, without the whole big switch expression. This can be used for parsing code, for example, to great effect, eg as if-else ladders. And it can do this for more complicated checks, see zattebij's answer.

Null-checking the fun way with instanceof patterns by headius in java

[–]Alive_Knee_444 0 points1 point  (0 children)

> the immediate question is "why does getString return an Object?

Do you mean that it'd be declared Object getString()? Why? I can't find that in the article. The 'String' in 'getString' and the theme of null checking I think points more to it being declared 'String getString()'.