IN and OUT template processors ?
Guy Steele
guy.steele at oracle.com
Tue Jun 6 14:46:22 UTC 2023
I agree that it may be desirable to have certain “quick and easy” input/output mechanisms for use by novice programmers using the on-ramp (nameless classes), but I really don’t understand the motivation for conflating that with the string template mechanism—using side effects in string template processors could have a lot of drawbacks, and I don’t see that it has any advantages over simply using I/O methods with FMT templates other than perhaps a tiny amount of abbreviation. What am I missing?
—Guy
> On Jun 6, 2023, at 2:56 AM, Remi Forax <forax at univ-mlv.fr> wrote:
>
> Hi all,
> thinking a little bit about STR and FMT, I wonder if we should not introduce also two other template processors, IN and OUT.
>
> IN is the input template processor, it asks a user for a string on the standard input
> String name = IN."what is your name ?";
>
> It works like input (raw_input) in Python or scanf in C.
>
>
> OUT is the output template processor, it prints a string to the standard output
> OUT."Hello World!"
>
> It works like print in Python or printf in C.
>
>
> I believe IN and OUT work quite well when combined with the unamed class syntax
>
> void main() {
> String name = IN."what is your name ?";
> OUT."Hello \{name}";
> }
>
>
> IN and OUT can be real classes (IO.Input and IO.Output *) so they can be completed by adding several useful static methods, like IN.input(), IN.inputAsInt(), etc and OUT.println(), OUT.printf(), etc
>
> regards,
> Rémi
>
> * with IO being a class that provides simple static methods for reading/writing files
More information about the amber-spec-experts
mailing list