in reply to On elegant coding...
in thread Just thinking ...
## main loop if (cache_is_good()) { show_cache_and_exit("current"); } # INSTEAD BECOMES cache(GOOD) && show_cache && exit('current');
Prince "--'s here I come! Where is the preview button for comments? Why is this TEXTAREA so small? I cant see anything?" PAWNif (cache_is_stale()) { if (i_am_the_writer()) { if (i_can_fork()) { if (i_am_the_parent()) { show_cache_and_exit("stale"); } ## child does: be_a_child(); update_cache(); exit 0; } ## cannot fork, so it's up to me update_cache(); show_cache_and_exit("current"); } ## I'm not the writer, so show old cache show_cache_and_exit("stale"); } #### BECOMES (cache(BAD) && sleep(5) && redo) || (cache(STALE) && (!i_am_writer && show_cache && exit(STALE)) || ( i_am_writer && (forkable() && ( (parent && show_cache && exit(STALE)) || (child && update_cache && exit(0) )) || (update_cache && exit(CURRENT) )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: On elegant coding...
by merlyn (Sage) on Oct 14, 2000 at 07:57 UTC | |
by princepawn (Parson) on Oct 19, 2000 at 17:05 UTC | |
by tilly (Archbishop) on Oct 20, 2000 at 12:44 UTC |