[plt-scheme] I miss end-of-time...
On Mar 11, 2010, at 2:57 PM, John Clements wrote:
>> With an "end-of-time" function, it's trivial: the key handler ignores its parameters and calls "end-of-time".
>
> I think the conclusion here is that imperative interfaces allow hiding of state, and make certain programs appear much simpler; it sounds like you just need to wait on writing that program until you've got structures. No?
In general, I like to aim for "the solution involves only concepts that were present in the problem statement." Not every good program meets that test -- testing for primality by using the Little Fermat Theorem springs to mind -- but it's a good initial goal.
The animation I described obviously involves responding to time, and responding to the keyboard, so tick handlers and key handlers are justified. It obviously involves stopping. It obviously involves circles of a specified radius, and it involves incrementing the radius. Those concepts are all present in the problem statement, so they'll almost certainly appear in the solution. Conditionals, structs, and "cons" are NOT in the problem statement, so I'd like to be able to solve the problem without them. With "end-of-time", I could.
Even once I introduce conditionals (after Spring Break), the various solutions proposed all involve special "quitting" values for the model, which feel less natural than just saying "if the user has hit the 'q' key, stop."
"end-of-time" feels to me like throwing an exception. If that's what you mean by "imperative interfaces", then so be it....
Stephen Bloch
sbloch at adelphi.edu