2 ms·
I'm torn on this, because although it's easy to say that for a toy example like this, when these "preconditions" evolve over time, you get things like: whi
by mehrdadn 8y ago
I'm torn on this, because although it's easy to say that for a toy example like this, when these "preconditions" evolve over time, you get things like:
while 1:
now = time()
if now > prev_time + UPDATE_TIME: report_progress()
foo = check_foo()
if not foo: break
if foo < 0: print_error(); break
do_foo(foo)
prev_time = now
Now, was it really dictating a precondition? Or was it actually dictating a postcondition? Or both or neither? Would you really want these responses to dictate the locations of the condition in the syntax? Because it seems to me that forcing yourself to put these conditions in the loop condition just makes the code extremely ugly and difficult to evolve (requiring you to duplicate code or have very convoluted expressions with assignments).