On Thu, Jun 10, 2010 at 04:25:37PM -0400, Mike Caron wrote:
> On 09/06/2010 7:50 PM, James Paige wrote:
>> I have noticed that sometimes new users misunderstand how the "if"
>> command works. I see someone write code like:
>>
>>    if(condition) then(action)
>>
>> but this code only runs once in their "new game" script, and they wonder
>> why "action" fails to happen each and every time that "condition" comes
>> true
>
> This smells like a PEBCAK problem. At no point in my time programming  
> have I ever assumed that an if will keep "trying" after the program  
> moves on. If they want it to loop, they should let someone (i.e., the  
> compiler) know!

Oh, *definitely* a PEBCAK problem. It is just that it is a common enough 
PEBCAK that it got me thinking about whether such a structure would be 
intutive.

>> Does that seem like a thing that would be worth having? It seems pretty
>> cool to me... but I can't think of any other language* with a similar
>> flow control structure, which makes me wonder if it has already been
>> tried and declared harmful by older wiser minds.
>
> This idea is basically closures  
> (http://en.wikipedia.org/wiki/Closure_%28computer_science%29). In a  
> nutshell, a closure is a function that has the following properties:

Nifty!

>> (* actually, I can think of one language that has something like this.
>> The machine language for the ancient Daytronics System-10 mainframe has
>> the EXU command which executes code any time a logic bit changes state.
>> This is also the one and ONLY flow control of any kind that the language
>> supports. All other flow control patterns have to be painstakingly
>> cobbled together with a series of EXU commands and bit flips)
>
> That sounds insane. I can't imagine trying to make that work.

My employer uses one of these to control a tensile stress testing 
machine. The operator inputs min and max values for the desired force. 
The force sensor is wired to the computer, and the computer watches the 
input and flips a logic bit for each of the min and max thresholds when 
the input crosses them. That bit flip triggers EXU commands which run 
code to run the motor in the correct direction to get the tension back 
in range.

And yes it is crazy. I hate that machine.

---
James
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to