'unknown operand' on OS X #3

Closed
zyxar opened this Issue May 14, 2012 · 5 comments

Comments

Projects
None yet
2 participants

zyxar commented May 14, 2012

compilation is smooth, with libtecla installed. However, when invoking oh, it initially prints [: ]: unknown operand, and then the prompt '>'. What's worse, the 'script' mode does not work, in which the oh shell only prints the warning mentioned above, then exits.

I've used grep to see where the warning comes from. However the go src and oh do not contains this string.

I believe the warning is produced around the function engine.go/Evaluate.

btw, Linux does not have this issue.

Owner

michaelmacinnis commented May 14, 2012

Hi,

Unfortunately I don't have an OS X machine for testing. I'm wondering if the '[: ]: unknown operand' is being printed by libtecla.

You say the "'script' mode does not work" and that the shell prints the same warning and exits. Could you provide more detail? What script were you trying to run?

Michael.

zyxar commented May 15, 2012

@michaelmacinnis the scrips were from the subdir examples of oh.
My mistake, the script mode works.
But the annoying warnings also exists in script mode, like the title message of this. I was wondering whether it came from zsh. But invoking from bash does not eliminate the warning.

  • Using strings /bin/zsh | grep operand, or strings /bin/zsh | grep unknown would show positive results, but not exact unknown operand.
  • As oh is only linked against libtecla, libncurses, and libSystem.B here on OS X, strings utility does not indicate other positive answers.

BTW, the import-prime.oh gives an error message:
*oh: interface conversion: main.Pair is not main.Interface: missing method Access

zyxar commented May 15, 2012

the import-prime.oh issue was caused by import "./examples/another-prime.oh", so that this script can only be executed under top directory. but error message is confusing...

zyxar commented May 15, 2012

@michaelmacinnis the annoying warning is caused by the last sentence of raw string in engine.go: [ -r (add $HOME /.ohrc) ] && source (add $HOME /.ohrc). The reason is similar to the post I mentioned above.

the workaround is changing this line to :

test -r (add $HOME /.ohrc) && source (add $HOME /.ohrc)

BTW (both on Linux and OS X):

  • add in oh:
    "oh: interface conversion: *main.Pair is not main.Atom: missing method Add"
  • source in oh:
    it would create a file named () in pwd.
Owner

michaelmacinnis commented May 15, 2012

The import uses a path that is relative to the current working directory. I agree that the error message is confusing. Currently, error checking in oh is minimal and error messages are vague.

I've changed the line:

[ -r (add $HOME /.ohrc) ] && source (add $HOME /.ohrc)

to:

test -r (add $HOME /.ohrc) && source (add $HOME /.ohrc)

Thanks for tracking this down! Please let me know if you have any further problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment