71104 / lambda

The Lambda Programming Language
MIT License
19 stars 2 forks source link

ListValue and NativeArrayValue are incompatible #91

Closed 71104 closed 8 years ago

71104 commented 8 years ago

Both have a values field, but the former contains AbstractValues while the latter contains native values.

This causes operators to produce buggy results, e.g.:

> (+ lol {1, 2, 3})[0]
TypeError: value.is is not a function
    at Function.LazyValue.evaluate (lambda/bin/lambda.js:502:13)
    at AbstractNode.SubscriptNode.evaluate (lambda/bin/lambda.js:1166:28)
    at lambda/bin/Main.js:23:49
    at REPLServer.require.start.eval (lambda/bin/Main.js:32:18)
    at bound (domain.js:287:14)
    at REPLServer.runBound [as eval] (domain.js:300:12)
    at REPLServer.<anonymous> (repl.js:431:12)
    at emitOne (events.js:77:13)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:211:10)

The above assumes that lol is a native array containing one or more values.

The + operator produces a concatenation of lol and {1, 2, 3}, but the values field of the resulting list has partly native and partly Lambda values.