this post was submitted on 16 Sep 2023
47 points (83.1% liked)
Programming
17398 readers
153 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Actually, this is because
void
is not a type, it is just a keyword, a placeholder used instead of the return type when a function doesn't return anything.If it were a bottom type, that would mean that a method returning
void
must diverge, which is simply not true.Also, if it were a bottom type, it would be possible to write an "unreachable" method
Even though it couldn't be called, it should be possible to define it, if
void
was a bottom type. But it is not, becausevoid
isn't a bottom type, it's no type at all.The post has been edited; it looks like someone on reddit made essentially the same point. You're right of course that
void
isn't a true type in Java, but the post now also discusses Void, which I suppose just shows how void infects the type system despite not being a type.