17525, "vasslitvinov", "Should 'read()' be available for all programs? otherwise, a doc bug", "2021-04-05T17:43:48Z"
This issue suggests that read
-ing values from stdin is a basic functionality like math functions and should not require use
-ing any modules.
For example:
var x: int;
var y: real;
/* reading into variable expressions, returning
true if the values were read, false on EOF */
var ok:bool = read(x, y);
/* reading via a single type argument */
x = read(int);
y = read(real);
/* reading via multiple type arguments */
(x, y) = read(int, real);
If we stick with the status quo, we need to fix online docs.
The online docs for ChapelIO has the following claims prior to the above code:
- "All Chapel programs automatically use this module by default. An explicit use statement is not necessary." and
- "This section describes automatically included basic types and routines"
Yet, currently that code requires use IO
, so users are surprised by a compiler error when trying it out.