I think the following always holds: isUserAGoat==!isComputerOn, in other words the user is a goat if and only if the computer is off.
How to programmatically find out if computer is on
21–30 of 197 posts
Re: How to programmatically find out if computer is on
#22> If the computer isn't on, the value returned by this function is undefined. Shouldn't it just block until the computer turns back on? Probably interferes with pthreads.
Re: How to programmatically find out if computer is on
#23Re: How to programmatically find out if computer is on
#24is_computer_on_fire() seems more usable...
Interesting it seems to come from BeOS:
https://github.com/haiku/haiku/commit/bcf475ec65f1060c0a8abf...
where the same function had a hn thread about it already a couple years ago :D
Re: How to programmatically find out if computer is on
#25Re: How to programmatically find out if computer is on
#26Given a lump of silicon, how does one programmatically tell if it is a computer?
Re: How to programmatically find out if computer is on
#27Functional programming with monads is the right way to implement this.
I'm sure some impurity "pragmatist" will try to argue you can make a perfectly good version of it as `Bool`. That kind of pragmatism is better ignored because it interferes with compiler optimization and standardization. As an example, you can look at the recent discussion around `==` and `/=`.
(And I just noticed some people may seriously argue that, so here comes the /s.)
Re: How to programmatically find out if computer is on
#28Re: How to programmatically find out if computer is on
#29> If the computer isn't on, the value returned by this function is undefined. Shouldn't it just block until the computer turns back on? Probably interferes with pthreads.
Hmm, it seems like you need to make sure the computer is on before calling this function, or else you run the risk of getting back undefined data. Seems like we also need a function that can be used to tell if the computer is on...
...What do you mean not every power supply manufacturer implements the power_on_computer() function as a NOOP if the computer is already on?!
Re: How to programmatically find out if computer is on
#30add a // TODO in v2: handle case if it never returns, or the process crashes, or caller times out waiting