Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Meta

What are the rules of programming language compliance?

+5
−0

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?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

2 answers

You are accessing this answer with a direct link, so it's being shown above all other answers regardless of its score. You can return to the normal view.

+4
−0

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.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

General comments (6 comments)
+5
−1

If there exists something (reasonable) that can run it, it's valid.

This includes obscure, non-standards-compliant compilers (though this should be specified in the answer if needed). So any posted program on a standard code-golf question must actually be executable and should (at least theoretically) complete the required task.

Depending on the situation, it may or may not make sense to count the compiler/interpreter flags in the byte count of the answer. The specifics depend on the language (e.g. no need to count file name or a generic "please compile" flag, but -Dm=main(){puts("Hello, World!");} must be counted for a C compiler.)

(The "reasonable" requirement is there to prevent needing a CPU with a specific name, precise free disk space, or just a plain file with some source code already on the file system)

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

General comments (24 comments)

Sign up to answer this question »