0xfaded / eval

BSD 3-Clause "New" or "Revised" License
34 stars 7 forks source link

panic on builtin append with integer value #44

Closed rocky closed 10 years ago

rocky commented 10 years ago
$ ./go-repl 
=== A simple Go eval REPL ===

Results of expression are stored in variable slice "results".
The environment is stored in global variable "env".

Enter expressions to be evaluated at the "go>" prompt.

To see all results, type: "results".

To quit, enter: "quit" or Ctrl-D (EOF).
go> append(os.Args, "abc", "def", 1)
panic: reflect: call of reflect.Value.Set on zero Value

goroutine 1 [running]:
runtime.panic(0x819d0c0, 0x187461c0)
    /usr/local/go/src/pkg/runtime/panic.c:266 +0xac
reflect.flag.mustBeExported(0x0)
    /usr/local/go/src/pkg/reflect/value.go:249 +0x6f
reflect.Value.Set(0x816c940, 0x1871b690, 0x186, 0x0, 0x0, ...)
    /usr/local/go/src/pkg/reflect/value.go:1380 +0x37
github.com/0xfaded/eval.evalBuiltinAppendExpr(0x187001e0, 0x1871c270, 0x1871c0f0, 0x6, 0xffffff01, ...)
    /home/rocky/go/src/github.com/0xfaded/eval/evalbuiltin.go:151 +0x497
github.com/0xfaded/eval.evalCallBuiltinExpr(0x187001e0, 0x1871c270, 0x1871c0f0, 0x18746100, 0x10, ...)
    /home/rocky/go/src/github.com/0xfaded/eval/evalbuiltin.go:26 +0x101
github.com/0xfaded/eval.evalCallExpr(0x187001e0, 0x1871c270, 0x1871c0f0, 0x1871c270, 0x8052801, ...)
    /home/rocky/go/src/github.com/0xfaded/eval/evalcallexpr.go:11 +0x111
github.com/0xfaded/eval.EvalExpr(0x187001e0, 0xb772cd60, 0x1871c270, 0x1871c0f0, 0xb772cd60, ...)
    /home/rocky/go/src/github.com/0xfaded/eval/evalexpr.go:49 +0x2a8
main.REPL(0x1871c0f0)
0xfaded commented 10 years ago

Builtins don't have proper type checking yet. Basically it will just take a fair bit of elbow grease to consider each one case by case.

Carl 2014/01/27 2:06 "R. Bernstein" notifications@github.com:

$ ./go-repl === A simple Go eval REPL ===

Results of expression are stored in variable slice "results". The environment is stored in global variable "env".

Enter expressions to be evaluated at the "go>" prompt.

To see all results, type: "results".

To quit, enter: "quit" or Ctrl-D (EOF). go> append(os.Args, "abc", "def", 1) panic: reflect: call of reflect.Value.Set on zero Value

goroutine 1 [running]: runtime.panic(0x819d0c0, 0x187461c0) /usr/local/go/src/pkg/runtime/panic.c:266 +0xac reflect.flag.mustBeExported(0x0) /usr/local/go/src/pkg/reflect/value.go:249 +0x6f reflect.Value.Set(0x816c940, 0x1871b690, 0x186, 0x0, 0x0, ...) /usr/local/go/src/pkg/reflect/value.go:1380 +0x37github.com/0xfaded/eval.evalBuiltinAppendExpr(0x187001e0, 0x1871c270, 0x1871c0f0, 0x6, 0xffffff01, ...) /home/rocky/go/src/github.com/0xfaded/eval/evalbuiltin.go:151 +0x497github.com/0xfaded/eval.evalCallBuiltinExpr(0x187001e0, 0x1871c270, 0x1871c0f0, 0x18746100, 0x10, ...) /home/rocky/go/src/github.com/0xfaded/eval/evalbuiltin.go:26 +0x101github.com/0xfaded/eval.evalCallExpr(0x187001e0, 0x1871c270, 0x1871c0f0, 0x1871c270, 0x8052801, ...) /home/rocky/go/src/github.com/0xfaded/eval/evalcallexpr.go:11 +0x111github.com/0xfaded/eval.EvalExpr(0x187001e0, 0xb772cd60, 0x1871c270, 0x1871c0f0, 0xb772cd60, ...) /home/rocky/go/src/github.com/0xfaded/eval/evalexpr.go:49 +0x2a8 main.REPL(0x1871c0f0)

— Reply to this email directly or view it on GitHubhttps://github.com/0xfaded/eval/issues/44 .