Comments on What are the rules of programming language compliance?
Parent
What are the rules of programming language compliance?
Code Golf seems like a fun idea to me, since I'm a programmer by trade and "language lawyer" nerd as a hobby.
But every time I checked the code golf site on SE, I dismissed it as nonsense, because the vast majority of all programs that were posted & highly up-voted there won't even compile on the most basic, compliant compiler for that language.
That kind of defeats the whole point of code golf, since anyone can just post some random incomplete snippet which can't even execute - then claim that they reduced the amount of characters quite a bit by doing so.
Obviously the site needs some set rules for this. Could someone illuminate this part to a newbie:
-
What are the rules in general for programming language compliance?
-
What are the specific rules for individual programming languages and where can one find those?
Post
Regarding
because the vast majority of all programs that were posted & highly up-voted there won't even compile on the most basic, compliant compiler for that language.
Code Golf allows functions as answers.
For example, this could be a Java hello world program, even though it obviously does not compile:
()->"Hello World!"
This is an anonymous lambda which returns the intended output. To actually run it, you would have to wrap it in code that looks something like this.
P.S. According to rules established on SE, the above could be golfed to a->"Hello World!"
to save a byte by taking in an unused argument, but that's not the point of this answer.
0 comment threads