In the attached program, compilation results in:

$CHPL_HOME/modules/standard/IO.chpl:3794: In function 'read':
$CHPL_HOME/modules/standard/IO.chpl:3797: error: unresolved call
'channel(false,dynamic,true).read(string, style=type iostyle, error=syserr)'
<<< list of attempted function matches >>>



Looking around IO.chpl:3797, I find the function declaration:

pragma "no doc"
proc channel.read(ref args ...?k,
                  style:iostyle):bool {
  var e:syserr = ENOERR;
  this.read((...args), style=iostyle, error=e); // this is line 3797
  if !e then return true;
  else if e == EEOF then return false;
  else {
    this._ch_ioerror(e, "in channel.read(" +
                        _args_to_proto((...args), preArg="ref ") +
                        "style:iostyle)");
    return false;
  }
}



I believe that the call at 3797:

this.read((...args), style=iostyle, error=e); // this is line 3797

is in error, since it passes iostyle (which is a type) to read, when it is
expecting an instance of iostyle.

I believe this to be incorrect behavior because the specification of readln
(
http://chapel.cray.com/docs/latest/modules/standard/IO.html#IO.channel.readln
)
shows that I should be able to pass an instance of an iostyle object to
style:

proc channel.readln(ref args ...?k, style: iostyle, out error: syserr): bool



Changing line 3797 to be:

this.read((...args), style=style, error=e);

seems to solve this error.

Also, is there a straight-forward way to read a full line from a channel
into a variable?
I cannot seem to form an iostyle that will read all bytes of a line.

-Ian J. Bertolacci

Attachment: test.chpl
Description: Binary data

------------------------------------------------------------------------------
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to