IN and OUT template processors ?
Remi Forax
forax at univ-mlv.fr
Tue Jun 6 06:56:23 UTC 2023
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