From: Phil!Gregory Date: 22:08 on 25 Aug 2006 Subject: Delphi. Excessive type-bondage. Allow me to quote from the Delphi help file: For a variable parameter, the actual argument must be of the exact type of the formal parameter. procedure SwapBytes(var B1, B2: Byte); var Temp: Byte; begin Temp := B1; B1 := B2; B2 := Temp; end; var C1, C2: 0..255; (*Similar to a byte, but NOT identical*) begin SwapBytes(C1,C2); (*<-- Error message here*) end. Arguments C1 and C2 are not acceptable to SwapBytes, *although they have the exact memory representation and range that a Byte has*. [Emphasis mine.] Oh, and for the case where I specifically ran into this, typecasting won't help. Apparently when you typecast a variable, the result looks like a constant to the compiler so you can't pass it as a variable parameter (pass by reference).
From: peter (Peter da Silva) Date: 23:03 on 25 Aug 2006 Subject: Re: Delphi. Excessive type-bondage. > Arguments C1 and C2 are not acceptable to SwapBytes, *although they have > the exact memory representation and range that a Byte has*. [Emphasis > mine.] That's because Delphi is Pascal on drugs. (well, ALL Pascal is Pascal on drugs, including Wirth's own implementation which we used at Berkeley before they replaced pascals with pix, because when Pascal's sober it wouldn't even put out for Niklaus)
Generated at 10:28 on 16 Apr 2008 by mariachi