Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

fib example broken #15

Open
candera opened this issue Nov 21, 2013 · 9 comments
Open

fib example broken #15

candera opened this issue Nov 21, 2013 · 9 comments
Milestone

Comments

@candera
Copy link

candera commented Nov 21, 2013

When I run ./fib.gk in the current version, it prints

#<function:48>

I'm on cygwin, and bash --version reports

bash --version
GNU bash, version 4.1.10(4)-release (i686-pc-cygwin)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
@candera
Copy link
Author

candera commented Nov 21, 2013

Umm. fib is still broken. Am I missing something?

@alandipert
Copy link
Owner

If you're seeing the exact same problem still, you might be missing something and should pull again. If you're seeing a different flavor of broken, it might be related to the fact that you're on cygwin - you might be the first.

@candera
Copy link
Author

candera commented Nov 21, 2013

Works now. Thought I had pulled already, but I guess not! Thanks!

@quoll
Copy link
Collaborator

quoll commented Nov 21, 2013

When Craig reported this, I couldn't run:

./gherkin -l fib.gk

After the change, this runs for me.

However, the original problem still fails to run for me:

./fib.gk
./fib.gk: line 3: syntax error near unexpected token `lst'
./fib.gk: line 3: `  (fn (lst & more)'

On Thu, Nov 21, 2013 at 2:04 PM, Craig Andera [email protected]:

Works now. Thought I had pulled already, but I guess not! Thanks!


Reply to this email directly or view it on GitHubhttps://github.com//issues/15#issuecomment-29013188
.

@candera
Copy link
Author

candera commented Nov 22, 2013

I'm getting the same thing under OS X: ./fib.gk gives a syntax error. Works under cygwin.

@alandipert alandipert reopened this Nov 22, 2013
@alandipert
Copy link
Owner

I think this is related to the difference in shebang handling between OS X and Linux, but I'm not sure what the best way to proceed is.

In a nutshell, OS X appears to be passing the script contents (instead of the script path) to gherkin, and bash is trying to interpret the Lisp code.

@candera
Copy link
Author

candera commented Nov 22, 2013

One hack might be to check the first two characters of input and see if they're a shebang, and self-call with the canonical form.

@kanaka
Copy link
Collaborator

kanaka commented Nov 22, 2013

I thought I pushed it already, but I guess not. So I would like to make a change so that gherkin doesn't need -l for the shebang line (/usr/bin/env behaves differently on different platforms with regard to dash arguments). In other words, the default is to treat positional arguments as files to run. I think that would make at least one case of shebangs less problematic. Sound reasonable?

@alandipert
Copy link
Owner

@kanaka 👍 In the meantime re: the general weirdness of shebang, I propose we create an examples/ directory and add a "Running the Examples" section of the readme that demonstrates executing fib.gk and other examples via ./gherkin <examples/example.gk>.

At least then newcomers on most platforms will have a good tire-kicking experience.

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

No branches or pull requests

4 participants