Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!apple!lins
From: lins@Apple.COM (Chuck Lins)
Newsgroups: comp.lang.modula2
Subject: Question on Logitech Type Conversion
Keywords: Logitech, Type Conversion, Opaque types
Message-ID: <35093@apple.Apple.COM>
Date: 28 Sep 89 16:22:19 GMT
Organization: Apple Computer Inc., Cupertino, CA
Lines: 57

It has been reported to me by someone in Japan regarding a type transfer/
conversion problem with the Logitech Modula-2 compiler (sorry I don't know
which version). Here's the problem:

There's a module exporting an opaque type, Item, which is defined as a 4-byte
address in the implementation. E.G.,

DEFINITION MODULE Items;
TYPE Item;
END Items.

IMPLEMENTATION MODULE Items;
TYPE Item = ADDRESS; (* assume the necessary IMPORTs *)
END Items.

Item is treated as a generic 4-byte quantity by other modules of a library of
data structures. For example, in a Stack module one my want a stack of CHARs,
and assuming the proper instaniation of a stack, etc. you could write:

StackModule.Push(toMyStack, Item(someCharacterVariable));

The specific example I have is summarized as:

IMPLEMENTATION MODULE ItemOperations;
...
PROCEDURE CharCompare (left:Item; right:Item): Relation;
VAR leftChar : CHAR;
    rightChar: CHAR;
BEGIN
  leftChar := CHAR(left); (* error: 'uncompatible types in conversion' *)
  rightChar:= CHAR(right); (* same error *)
  ... blah, blah using the characters
END CharCompare;
...
END ItemOperations.

This all compiles fine under JPI's TopSpeed Modula-2. I suspect that this
compiles ok under the Stony Brook compiler (I don't have any reports to the
contrary). The same error is apparently reported on other type conversions as
well (e.g., to an INTEGER).

BTW, this is all part of the "Modula-2 Software Component Library" - so if
there's anyone out there using the library with the Logitech compiler please
let me know if there's a problem here. Or if you're using the library on
_any_ other compiler and have had problems definitely let me know.

Thanks in advance.

Chuck Lins

-- 
Chuck Lins               | "Exit left to funway."
Apple Computer, Inc.     | Internet: lins@apple.com
20525 Mariani Avenue     | AppleLink: LINS
Mail Stop 41-K           | 
Cupertino, CA 95014      | "Self-proclaimed Object Oberon Evangelist"
I speak for myself and no one else.