I'm not sure what the point of this is. It seems pretty petty. To wit, we could have just we well written... MACLISP (1980): (format t "Week ~R of the ~:R month of the year ~:@R~%" 15 102 1996) --> Week fifteen of the one hundred second month of the year MDCCCCLXXXXVI C/C++/Java/Python/Ruby: ...uh... COMMON LISP: (format t "Week ~R of the ~:R month of the year ~:@R~%" 15 102 1996) --> Week fifteen of the one hundred…
The March of Progress (in programming language syntax :)
11–20 of 29 posts
Re: The March of Progress (in programming language syntax :)
#12Re: The March of Progress (in programming language syntax :)
#13None of these are syntax. `printf` in C or scala/groovy is a function call, which relates to the language's API, the C++ use of streams is an API decision, Java being funky is due to its API (and its semantics to a lesser extent). The only language I can think of off the top of my head where print would be syntax would be python, and even then 1) that's only for versions <=2, and 2) the formatting would still be an A…
I personnaly don't like the printf/scanf style, which unfortunately often prevails in newer languages. I definitely prefer the string interpolation method, or just plain string concatenation.
Re: The March of Progress (in programming language syntax :)
#14 1956: Fortran I:
PRINT 1, X
1 FORMAT (F10.2)
Fortran was able to use the same format specification for more than one print statement, that's why the format statement is referenced by number. It was even able to do repeats, for example this code from 1956 PRINT 2, X, Y, A, B, C, D, N
2 FORMAT ( 3 ( F10.3, F10.4 ), I4 )
is an equivalent of the following C: printf( "%10.3f%10.4f%10.3f%10.4f%10.3f%10.4f%4d",
x, y, a, b, c, d, n );
Moreover, C interprets the format specification at runtime, in FORTRAN the compiler uses it during the compilation.Fortran was invented by John Backus and there was already a finished compiler in 1956:
"Programmer's Reference Manual Fortran Automatic Coding System For IBM 704"
http://www.fh-jena.de/~kleine/history/languages/FortranAutom...
I/O in the first Fortran, I believe including the FN.M syntax, was implemented by Roy Nutt, also one obvious genius:
http://www.smartcomputing.com/editorial/dictionary/detail.as...
Re: The March of Progress (in programming language syntax :)
#15The proper list starts with: 1956: Fortran I: PRINT 1, X 1 FORMAT (F10.2) Fortran was able to use the same format specification for more than one print statement, that's why the format statement is referenced by number. It was even able to do repeats, for example this code from 1956 PRINT 2, X, Y, A, B, C, D, N 2 FORMAT ( 3 ( F10.3, F10.4 ), I4 ) is an equivalent of the following C: printf( "%10.3f%10.4f%10.3f%10.4f%…
printf( format, x, y, a, b, c, d, n );
You can get similar behavior from C, reusing the format specification? No idea if this was true in the K&R days though.
Re: The March of Progress (in programming language syntax :)
#16You just have to type hello world in HTML. Beat that.
Re: The March of Progress (in programming language syntax :)
#17I'm not sure what the point of this is. It seems pretty petty. To wit, we could have just we well written... MACLISP (1980): (format t "Week ~R of the ~:R month of the year ~:@R~%" 15 102 1996) --> Week fifteen of the one hundred second month of the year MDCCCCLXXXXVI C/C++/Java/Python/Ruby: ...uh... COMMON LISP: (format t "Week ~R of the ~:R month of the year ~:@R~%" 15 102 1996) --> Week fifteen of the one hundred…
Clojure has cl-format. ( http://richhickey.github.com/clojure/clojure.pprint-api.html... )
Re: The March of Progress (in programming language syntax :)
#18OP is being manipulative, selecting a tiny slice of a language's API to exaggerate his petty point. You just have to type hello world in HTML. Beat that.
Re: The March of Progress (in programming language syntax :)
#19The proper list starts with: 1956: Fortran I: PRINT 1, X 1 FORMAT (F10.2) Fortran was able to use the same format specification for more than one print statement, that's why the format statement is referenced by number. It was even able to do repeats, for example this code from 1956 PRINT 2, X, Y, A, B, C, D, N 2 FORMAT ( 3 ( F10.3, F10.4 ), I4 ) is an equivalent of the following C: printf( "%10.3f%10.4f%10.3f%10.4f%…
char format[10] = "%10.3f%10.4f%10.3f%10.4f%10.3f%10.4f%4d"; printf( format, x, y, a, b, c, d, n ); You can get similar behavior from C, reusing the format specification? No idea if this was true in the K&R days though.
Still whoever uses some printf variant today, misses some aspects of what was working in 1956.
Re: The March of Progress (in programming language syntax :)
#20Earlier quoted context omitted.
char format[10] = "%10.3f%10.4f%10.3f%10.4f%10.3f%10.4f%4d"; printf( format, x, y, a, b, c, d, n ); You can get similar behavior from C, reusing the format specification? No idea if this was true in the K&R days though.
But not the repetition inside of one specification which I illustrated in the example (note the 3 before the braces in the 2 FORMAT), and much more important, no compile-time type checking and compile time code generation for output. In C it's a library call and most of the processing happens at the run-time. And yes I know of gcc checks. Still whoever uses some printf variant today, misses some aspects of what was w…
OCaml and Rust both have compile-time format string checking and code generation as well.