[comp.lang.modula3] Nit on Wr.i3

orgass+@rchland.ibm.com (Dick Orgass) (04/18/91)

In one sense, this question is a real nit but there is a longer term
performance question behind the nit.

The procedures Wr.PutString and UnsafeWr.FastPutString are both declared
so that the second parameter, the ARRAY OF CHAR to be written is a value
parameter.  This forces the compiler to write code to copy the array
just to again copy it into the writer's buffer; the intermediate copy is
then destroyed.

By examining the code of the implementations of these procedures (in
WrMove.m3), it's easy to see that the actual parameters are not modified.

I propose that the declaration of these procedures be changed as follows:

In Wr:

    PROCEDURE PutString(wr: T; READONLY a: ARRAY OF CHAR)
        RAISES {Failure, Alerted, Error};

In UnsafeWr:

    PROCEDURE FastPutString(wr: Wr.T; READONLY a: ARRAY OF CHAR)
      RAISES {Failure, Alerted, Error};

Dick

kalsow (Bill Kalsow) (04/20/91)

Thanks for pointing out the omission.  The next release
will change Wr.{Fast}PutString to take a READONLY ARRAY OF CHAR.

  - Bill Kalsow