[comp.lang.modula2] OBERON-M

Ian.Macintosh@p1.f15.n7101.z5.fidonet.org (Ian Macintosh) (06/25/91)

Hi.

I've been looking at the Oberon-M package (Ver 1.10) from E.R. Videki, and have come across the following problem that does not seem right to me.

It has to do with the compatability between BYTE and CHAR.  I extracted the pertinant code into a test module, and passed it through the compiler.

Here is the program:

======
MODULE TEST;

IMPORT SYSTEM;


VAR   ByteArray : ARRAY 10 OF SYSTEM.BYTE;
      CharArray : ARRAY 10 OF CHAR;


BEGIN
  CharArray[1] := ByteArray[1];
END TEST.
======

And here are the compiler response:

======
Oberon-M Compiler (tm)     PC-80x86 edition, v1.1 
(c) Copyright E. R. Videki 1989,1990,1991 All rights reserved
    P.O. Box 58, Morgan Hill, California 95038  U.S.A.

10: BEGIN
11:   CharArray[1] := ByteArray[1];
Syntax error 50 before line 11 column 33
types not compatible
======

The way I read the ObRept file, this should not cause a problem.  Here is the relevant section:

======

          Module SYSTEM exports the data type BYTE. No representation of
          values is specified. Instead, certain
          compatibility rules with other types are given:
          
          1.  The type BYTE is compatible with CHAR and SHORTINT.
          2.  If a formal parameter is of type ARRAY OF BYTE, then the
              corresponding actual parameter may be of any type.
      
======

Anybody have a simple answer for me?

I would also appreciate a pointer in the direction of some good books or articles on Oberon.  If there is anything available on computer, (text files, etc), it might be easier to get hold of, as South Africa is rather far away from most places. <grin>.

Regards,

Ian.




--  
uucp: uunet!m2xenix!puddle!5!7101!15.1!Ian.Macintosh
Internet: Ian.Macintosh@p1.f15.n7101.z5.fidonet.org

James.Meyer@f223.n151.z1.fidonet.org (James Meyer) (06/29/91)

IM>BEGIN
IM>  CharArray[1] := ByteArray[1];
IM>END TEST.
IM>======
IM>
IM>And here are the compiler response:
IM>
IM>======
IM>11:   CharArray[1] := ByteArray[1];
IM>Syntax error 50 before line 11 column 33
IM>types not compatible
IM>======
IM>
IM>          Module SYSTEM exports the data type BYTE. No representation of
IM>          values is specified. Instead, certain
IM>          compatibility rules with other types are given:
IM>
IM>          1.  The type BYTE is compatible with CHAR and SHORTINT.
IM>          2.  If a formal parameter is of type ARRAY OF BYTE, then the
IM>              corresponding actual parameter may be of any type.
IM>
IM>======
IM>
IM>Anybody have a simple answer for me?

Ian,
   Just because BYTE is compatable with CHAR doesn't necessasarily
imply the reverse.  Any CHAR may be a BYTE as well.  But any BYTE
might not be a CHAR.  Have you tried to assign CharArray
to ByteArray?  Reverse of the assignment in your example.

Jim

--  
uucp: uunet!m2xenix!puddle!151!223!James.Meyer
Internet: James.Meyer@f223.n151.z1.fidonet.org