[Oberon] Correction; ORD usage & etc.

Chris Burrows chris at cfbsoftware.com
Sat Jan 30 22:49:38 CET 2016


> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> peter at easthope.ca
> Sent: Sunday, 31 January 2016 6:11 AM
> To: oberon at lists.inf.ethz.ch
> Subject: [Oberon] Correction; ORD usage & etc.
> 
> From: peter at easthope.ca (Peter Easthope), Fri, 16 Oct 2015
> 18:39:58 -0500
> >   menuH := Fonts.Default.height + 2;
> >   barW := menuH;
> >   INC(menuH, ORD(Modern) * 6);
> 
> The argument of ORD is CHAR; not BOOLEAN.  This is more likely to
> succeed.
> 
> 	(* Kronecker delta *)
> 	PROCEDURE Kd(b: BOOLEAN): INTEGER;
> 		BEGIN IF b THEN RETURN 1 ELSE RETURN 0 END  END Kd;
>   ...
>     INC(menuH, Kd(Modern) * 6);
> 

Unless I'm missing some obscure trickery, I find that the following leads to
less mental gymnastics for me:

  menuH := Fonts.Default.height + 2;
  barW := menuH;
  IF Modern THEN INC(menuH, 6) END; 

Regards,
Chris



More information about the Oberon mailing list