Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env -S is platform-specific #25

Closed
simonmichael opened this issue Feb 9, 2023 · 10 comments
Closed

env -S is platform-specific #25

simonmichael opened this issue Feb 9, 2023 · 10 comments

Comments

@simonmichael
Copy link
Contributor

simonmichael commented Feb 9, 2023

On three entries (crappy-flappy, fifteen, pong) I just responded

Unfortunately I think we'll have to disallow env -S as it's not available on GNU/Linux (at least not until coreutils 9.x).

And in README I just added

Tips for rule 4 (runnability):

  • We must avoid arguments on the shebang line and env -S, which is not available on GNU/Linux, or at least not before coreutils such-and-such.

I imagine this will be bitter news for some. But achieving programs that "just work" is a core principle and very much part of the challenge, and env -S seems incompatible with this, alas.

What are your thoughts, do you see other options ?

@simonmichael simonmichael changed the title allow env -S ? disallow env -S ? Feb 9, 2023
@simonmichael simonmichael changed the title disallow env -S ? env -S is platform-specific Feb 9, 2023
This was referenced Feb 9, 2023
Merged
@simonmichael
Copy link
Contributor Author

I modified play so at least they are runnable that way.

@simonmichael
Copy link
Contributor Author

@TristanCacqueray
Copy link
Contributor

Perhaps lines without expressions (like comment or import) should not contribute to the 10 lines limit? That way, the games have room to declare the cabal/stack script preamble, and no longer need a separate Import file.

Otherwise, I think we should allow env -S since it enables using the first line, and more importantly, because games already rely on it.

@simonmichael
Copy link
Contributor Author

simonmichael commented Feb 9, 2023

For this round they do contribute, because it makes for a more realistic comparison with other languages (such as BASIC) and because the other entrants have worked to this constraint.

But.. we have already allowed dropping the shebang line as long as decent runnability is still maintained, eg by providing a reliable build command in the comments, and a couple of entries have relied on this. This is partly why the play script exists, to provide and paper over the required special invocations. (Also we have allowed unlimited comments at the end.)

I guess accepting special invocations to work around a missing shebang line, or a shebang line with arguments, are equivalent, and the status quo.

On the other hand it seems to mean that everybody working hard to fit the constraint, need not have bothered, and henceforth there's no point in putting any shebang line. This is slightly against the goal of challenging ourselves to produce self-contained haskell games comparable to classic BASIC games.

@bradrn
Copy link
Contributor

bradrn commented Feb 9, 2023

Forgive my ignorance, but would there be anything wrong with using #!/usr/bin/sh instead? Or does env do something special? I used it mostly because other people were using it, so I assumed it was the right thing to do.

@simonmichael
Copy link
Contributor Author

simonmichael commented Feb 9, 2023

/usr/bin/env PROG is considered a little more robust, because sh or other PROG can be installed at different paths on different systems. env searches $PATH for it.

gergoerdi added a commit to gergoerdi/tiny-games-hs that referenced this issue Feb 10, 2023
gergoerdi added a commit to gergoerdi/tiny-games-hs that referenced this issue Feb 10, 2023
@gergoerdi
Copy link
Contributor

In my case, I used env -S like this:

#!/usr/bin/env -S stack script --resolver=lts-19.21 --package ansi-terminal-game
-- stack script --ghc-options -threaded

So as you can see, I'm not really saving a line because I use up a second line for the ghc-options. However, I can't fit both --ghc-options -threaded and all the other Stack options into one --stack script line because then it goes over the 80-column limit.

Anyway I've found out that on LTS 20.10, it seems ansi-terminal-game no longer requires -threaded so I've removed env -S from my programs.

simonmichael pushed a commit that referenced this issue Feb 10, 2023
@simonmichael
Copy link
Contributor Author

Conclusion: env -S is allowed; the play script will shield linux users from it. But it's not the judges' most favourite style. :)

@gergoerdi
Copy link
Contributor

But it's not the judges' most favourite style. :)

Clearly a fate worse than death!

@simonmichael
Copy link
Contributor Author

simonmichael commented Feb 10, 2023

Well, now I used it myself in pong2, to save a line yet still be self-runnable for most people.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants