Page 1 of 1

'Simple' Assignment

Posted: Sun Aug 14, 2011 7:05 pm
by 4GlCoder
MODULE test;
IMPORT SYSTEM;
CONST
ByteV = 22;
VAR
aByte : SYSTEM.BYTE;
BEGIN
aByte := SYSTEM.VAL(SYSTEM.BYTE,ByteV);
END test.

The above code does work, but I find it hard to justify the needed SYSTEM.VAL type cast on a constant value.
where aByte := ByteV should do.
I think this just forces lazy/sloppy programming: Ok just slap in an INTEGER instead of a BYTE and it works. (without the type cast and without the !type cast! message..

Re: 'Simple' Assignment

Posted: Fri Feb 15, 2013 12:37 pm
by cfbsoftware
In Astrobe v4.3 and later BYTE is a regular data type so the above example can be written more simply as:

Code: Select all

MODULE Test;
CONST
  ByteV = 22;
VAR
  aByte: BYTE;
BEGIN
  aByte := ByteV
END Test.