hn-classics/_stories/2000/8780606.md

13 KiB

created_at title url author points story_text comment_text num_comments story_id story_title story_url parent_id created_at_i _tags objectID year
2014-12-21T19:25:17.000Z Is_computer_on_fire() (2000) http://everything2.com/title/is_computer_on_fire%2528%2529 adamnemecek 117 56 1419189917
story
author_adamnemecek
story_8780606
8780606 2000

Source

is_computer_on_fire() - Everything2.com

__

Near Matches Ignore Exact

Everything2

is_computer_on_fire()

| ----- | | (thing) | by **beek** | Fri Aug 18 2000 at 16:51:09 |

double **is_computer_on_fire(** void **)**
BeOS kernel function, returns the temperature of the motherboard if the computer is currently on fire. Smoldering doesn't count. If the computer isn't on fire, the function returns some other value. (Be Book)

see also: is_computer_on()


to be consistent with the naming conventions used in the rest of the BeOS API, this function should really be

        static bool BComputer::isOnFire();

and should return false if the computer is not on fire. I guess it's okay to return an undefined value when the computer is on fire.

| -----|
|

| I like it! | 1 C! |

| ----- | | (idea) | by **ariels** | Thu Sep 14 2000 at 11:34:11 |

This definitely lowers my opinion of BeOS. The coding style used is terrible! You should never name your predicates is_something. A predicate is not _asking_ a question, it is _answering_ it. Consider this code fragment:

if (is_computer_on_fire()) {
  dump_halon(computer_room);
}

You cannot read it out loud, because it doesn't sound like English.

Much better alternatives would be [computer][8]_is_on[_fire][29](), computer_on_fire() or the Lisp-like computer_on_fire_p() (using the -P convention). All of these let you read your code.

| -----|
|

| I like it! | |

| ----- | | (idea) | by **SlightlyMadman** | Thu Sep 14 2000 at 13:34:22 |

Actually, ariels, I'd say your suggestions are just as flawed. The big problem I see with this function, is that it looks, by its name, to be returning a boolean value, where it actually returns a double. I say it would more properly be named something along the lines of getFlamingMotherboardTemperature, or something like that.

Of course, I was greatly amused by this, and is_computer_on(), and immediately included them in the function library I'm currently using in a production system, to replace the random number generators.

| -----|
|

| I like it! | 1 C! |

| ----- | | is_computer_on() | The -P convention | lpt on fire | New UNIX filesystem permissions based on Everything2 behavior |
| Be Book | BeOS | Products that shoot flames | Response.IsClientConnected |
| Smoldering | Homeward Bound: The Incredible Journey | Predicate | Basic |
| Fire | Geeks | halon | double |
| Splinter | temperature | strfry | LISP |
| computer |   |   |   |

Log in or register to write something here or to contact authors.

Sign in

| ----- | | Login | |
| Password | |

remember me
Lost password

**Sign up**

Need help? accounthelp@everything2.com

About Everything2

User Picks

Editor Picks

New Writeups

(more)

Everything2 ™ is brought to you by Everything2 Media, LLC. All content copyright © original author unless stated otherwise.
Let sleeping demons lie.