gherkin icon indicating copy to clipboard operation
gherkin copied to clipboard

fib example broken

Open candera opened this issue 11 years ago • 9 comments

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 avatar Nov 21 '13 16:11 candera

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

candera avatar Nov 21 '13 18:11 candera

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.

alandipert avatar Nov 21 '13 18:11 alandipert

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

candera avatar Nov 21 '13 19:11 candera

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/alandipert/gherkin/issues/15#issuecomment-29013188 .

quoll avatar Nov 21 '13 23:11 quoll

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

candera avatar Nov 22 '13 02:11 candera

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.

alandipert avatar Nov 22 '13 03:11 alandipert

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.

candera avatar Nov 22 '13 12:11 candera

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?

kanaka avatar Nov 22 '13 13:11 kanaka

@kanaka :+1: 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.

alandipert avatar Nov 22 '13 17:11 alandipert