Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!pdn!oz!alan From: alan@oz.nm.paradyne.com (Alan Lovejoy) Newsgroups: comp.lang.modula2 Subject: Re: type conversion question Message-ID: <6187@pdn.paradyne.com> Date: 14 Jun 89 14:00:09 GMT References: <14226@watdragon.waterloo.edu> <7465@xenna.Encore.COM> Sender: news@pdn.paradyne.com Reply-To: alan@oz.paradyne.com (Alan Lovejoy) Organization: AT&T Paradyne, Largo, Florida Lines: 40 In article <7465@xenna.Encore.COM> soper@xenna.UUCP (Pete Soper,,,) writes: >From article <14226@watdragon.waterloo.edu>, > by djsalomon@watdragon.waterloo.edu (Daniel J. Salomon): >> >> Use the standard procedure VAL. E.g. > > Which standard? Many implementations do not have VAL as it came along with >the 3rd edition of the Wirth book and the single pass compiler. Also, I >suggest Wiener and Ford as an alternative to the Wirth book. VAL has always been in the language. Where did you get the idea that it first appeared in PIM2v3? The problem with both VAL and "type transfer functions" (e.g., TYPENAME(x)) is that many compiler writers seem unable or unwilling to implement them correctly. VAL is supposed to perform MEANING-PRESERVING conversions that may require changing the number and/or value of bits. Type-transfer functions are supposed to perfrom BIT-PATTERN-PRESERVING conversions which may change the meaning of a value (e.g., CARDINAL(-1)). But many implementations do not conform to this specification. And PIM2v3 never clearly stated the compatibility rules of the LONG types, so of course every implementation adopts its own policy as it sees fit (if it even HAS long types). The other favorite misinterpretation of the definition of the language is the nutty idea that providing set types which can contain more elements than the number of bits in a WORD is "nonstandard." It is NOT!!!! PIM2 says only that implementations are not REQUIRED to support set types which can contain more elements than the number of bits in a WORD. But they are NOT FORBIDDEN from doing so. Any implementation that does not support SET OF CHAR is useless for most purposes. SETs are almost never used for anything except SET OF CHAR. One of the best things about the coming ISO standard for Modula-2 is that it promises to fix this intolerable situation. Alan Lovejoy; alan@pdn; 813-530-2211; AT&T Paradyne: 8550 Ulmerton, Largo, FL. Disclaimer: I do not speak for AT&T Paradyne. They do not speak for me. ______________________________Down with Li Peng!________________________________ Motto: If nanomachines will be able to reconstruct you, YOU AREN'T DEAD YET.