[comp.sys.mac.programmer] LSP v2 compile error - string func

a_dent@vaxa.uwa.oz (ANDY DENT, PH: 09 380 2620) (06/20/89)

The following is a copy of a unit declaration that reliably gets a compile 
error for the implementation portion saying that "the type of the function 
result doesn't match the earlier declaratation" which is funny because one is 
copied from the other.  What is even funnier is that there are no problems if 
the result is declared as str255.  I though that the LSP "string" type was a 
synonym for str255?  Note, this happens in v2.01 as well as v2.0.

---------- buggy unit starts here --------------
unit bugINLSP;
{ reliably gets error when compiling: }
{ Result type doesn't match previous declaration }
{ No problems using routine in main program, just can't declare as }
{ shown here - in a nice tidy unit. }
{ The funny thing is, no problems if I declare function as Str255 type }
{ instead of String !!!! }

interface
    const
        BufferSize = 2048;  { 2kb }
    type
        ioBuffer = packed array[1..BufferSize] of char;
        ioReadBuffer = record
                len, pos: longint;
                data: ioBuffer;
            end;

function stringFromBuffer (var Rbuf: ioReadBuffer; var empty: boolean): string;

implementation

function stringFromBuffer (var Rbuf: ioReadBuffer; var empty: boolean): string;
    begin
    end;  { stringFromBuffer }

end.

siegel@endor.harvard.edu (Rich Siegel) (06/28/89)

In article <342@vaxa.uwa.oz> a_dent@vaxa.uwa.oz (ANDY DENT, PH: 09 380 2620) writes:
>The following is a copy of a unit declaration that reliably gets a compile 
>error for the implementation portion saying that "the type of the function 
>result doesn't match the earlier declaratation" which is funny because one is 

	Bizarre. It seems to be a real bug, all right.

	The workaround is not to repeat the parameter list. (You can
put braces around it if you need it for reference.)

		--R.



~~~~~~~~~~~~~~~
 Rich Siegel
 Staff Software Developer
 Symantec Corporation, Language Products Group
 Internet: siegel@endor.harvard.edu
 UUCP: ..harvard!endor!siegel

 I classify myself as a real developer because my desk is hip-deep in
 assembly-language listings and I spend more than 50% of my time in TMON.

~~~~~~~~~~~~~~~