[Oberon] Input.Timer in Native Oberon

Chris Burrows chris at cfbsoftware.com
Thu Jan 28 22:34:10 CET 2016


> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> peter at easthope.ca
> Sent: Friday, 29 January 2016 4:58 AM
> To: oberon at lists.inf.ethz.ch
> Subject: [Oberon] Input.Timer in Native Oberon
> 
> From joerg.straube at iaeth.ch  Tue Jan 12 11:31:53 2016
> > I like to move around the caret with my keyboard instead of the
> mouse ...
> 
> Input.Timer translates keypad arrow activation (KP-Right for example)
> to a displacement (INC(kdx, i) for example).
> 
> For time interval counter0, the displacement increment is
> 		i := counter0 DIV (100 DIV 12)+1;
> 
> Isn't 100 DIV 12 always 8?  Why not this arithmetic?
> 		i := counter0 DIV 8+1;
> 

I hven't looked at the code but presumably the values 100 and 12 have a
certain significance in this context? 

If 100 DIV 12 is pre-evaluated to 8 then that information is no longer
available to the reader of the code. The initial programmer would have to
add a comment if they wanted to provide that information - better to let the
code speak for itself.

Other examples are:

   PixelCount = 1024 * 768; (* Better than PixelCount = 786432; *)

   answer := 42;  (* Better than what?  See The Hitchhiker's Guide to the
Galaxy ;-) *)

Regards,
Chris

Chris Burrows
CFB Software
http://www.cfbsoftware.com







More information about the Oberon mailing list