Path: utzoo!attcan!uunet!mcvax!unido!infbs!neitzel From: neitzel@infbs.UUCP (Martin Neitzel) Newsgroups: comp.lang.modula2 Subject: Re^2: Error in PD Modula-2 compiler? Or just in my brain? Message-ID: <1230@infbs.UUCP> Date: 28 May 89 21:12:47 GMT References: <340@actisb.UUCP> <1091@gmdzi.UUCP> Followup-To: comp.lang.modula2 Distribution: comp Organization: TU Braunschweig,Informatik,West Germany Lines: 56 There are some "hard facts" regarding the original questions at the end of this article. Stay tuned. But before that, I just _have_ to insert a small reminder for all contributors of this group. In article <123@foo> Joe KouldBeAnybody writes: JK> JK> I compiled these files whith the XYZ-Modula2 and no errors were JK> or were not reported. There may be another cause for your error. Listen To What The Man Said: N. Wirth in "Programming in Modula2", 3rd corrected edition, and 4th ed., "1. Introduction": pim3> pim3> This report is not intended as a programmer's tutorial. pim3> It is intentionally kept concise, and (we hope) clear. pim3> Its function is to serve as a reference for programmers, pim3> implementors, and manual writers, and as an arbiter, should pim3> they find disagreement. Though the report fails to meet these goals in several ways, it can be used as primary reference, and should be. Thank you for your attention. Back to the original question: Q: PD-compiler or brain broken? A: Brain ok. ("Stay fit and healthy until you're dead." [D. Barry]) 1. What about the assignment "newStack := newList"? A declaration "TYPE Stack = List" introduces a new identifier for the same type [pim3, 6.1]. No type conversion of any kind is ever needed in contexts involving "both" types. They are "compatible" [pim3, 6.3]. From this follows that even "CreateList (newStack)" would be a valid procedure call. 2. What about the "bug-fix" involving type transfers? PIM3, "12. System-dependent facilities" (unchanged in pim4) pim3> pim3> Besides those exported from the pseudo-module SYSTEM, there are pim3> two other facilities whose characteristics are system-dependent. pim3> The first is the possibility to use a type identifier T as a pim3> name denoting the ``type transfer function'' from the type of pim3> the operand to the type T. Evidently, such functions are data pim3> representation dependent, and they involve no explicit pim3> conversion insrtuctions. [...] Thus, the cast "Stack (newList)" must be accepted by any conforming compiler. Notwithstanding the fact that your program may core dump at runtime at the very next occasion. So, there may very well exist a conforming Modula2-System, where the type transfers won't be useful for even the most simplest things. Martin Neitzel