4 ms·
To quote from chapter 1 of K&R C: "The only way to learn a new programming language is by writing programs in it. The first program to write is the same for all
by PhantomGremlin 7y ago
To quote from chapter 1 of K&R C: "The only way to learn a new programming language is by writing programs in it. The first program to write is the same for all languages:"
Print the words
hello, world
The program to do that is literally the very first program shown in the very first chapter of K&R C.
99% of Python programs before Python3 was announced used the print statement.
Python3 broke 99% of existing programs.
And your rebuttal is there are---now---nontrivial programs that run in both languages? How many of those nontrivial programs existed before python3 was announced?
Zero. Zero programs like that existed.
This historical revisionism astonishes me. Just because it is now, after the fact possible to write programs that behave the same in both Python2 and Python3 doesn't mean that they are the same language.
- takeda 7y agoHehe funny that you mentioned K&R, because hello world in original C no longer compiles in current compilers.
- PhantomGremlin 7y agoWorks for me. But maybe OpenBSD 6.2 isn't "current" enough for you? $ cat hello.c main() { printf("hello, world\n"); } $ cc hello.c hello.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] main() ^ hello.c:3:2: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration] printf("hello, world\n"); ^ hello.c:3:2: note: include the header <stdio.h> or explicitly provide a declaration for 'printf' 2 warnings generated. $ ./a.out hello, world $ uname -a OpenBSD foo.example.com 6.2 GENERIC.MP#0 amd64 I think this illustrates my point. OpenBSD did what was necessary to keep the vintage 1978 hello.c program working on a recent system. If only Guido and his colleagues did the same.
- loeg 7y agoNot criticizing OpenBSD, but this has nothing to do with OpenBSD in particular (which uses Clang now). Grandparent 'takeda is just flat wrong. hello.c compiles and runs with extremely modern Clang and GCC versions (8.0.1 RC and 9.2.0, respectively). The former is a development RC and the GCC was released August 2019. And we can expect this going forward! The C standard is extremely stable and loathe to deprecate anything. gets(3) is finally gone in C11 and it has been deprecated since the 1999 standard. That's the only ABI removal in C history. There is absolutely no reason to expect that tiny program which doesn't invoke gets(3) to ever stop being compilable by standards-conforming C compilers.