kevinlawler / kona

Open-source implementation of the K programming language
ISC License
1.36k stars 138 forks source link

no value errors in a lambda #540

Closed ngn closed 5 years ago

ngn commented 5 years ago
  {a}0 /as expected
value error
a
^
  {a x}0 /should fail
0
tavmem commented 5 years ago

In k2.8:

$ rlwrap -n ./k
K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems
Evaluation. Not for commercial use. 
\ for help. \\ to exit.

  {a}0
  {a x}0
0
tavmem commented 5 years ago

In k3.2:

$ ./k
K 3.2 2005-06-25 Copyright (C) 1993-2004 Kx Systems
  {a}0
  {a x}0
0
tavmem commented 5 years ago

Looks like this is not a bug.

tavmem commented 5 years ago

Arguably, if there is a bug, it is that Kona produces "value error" in the first case:

$ rlwrap -n ./k
kona      \ for help. \\ to exit.

  {a}0
value error
a
^
tavmem commented 5 years ago

Since Kona deviates from k2.8 and k3.2 in that Kona reports a "value error" for

{a}0

I will label this as a "bug". This might be a good issue for someone newly interested in developing Kona fixes.

tavmem commented 5 years ago

After the commit that closed this issue, Kona gives exactly the same results as k2.8 with the additional benefit that Kona does not add "a" to the k-tree.

$ rlwrap -n ./k
kona      \ for help. \\ to exit.

  {a}0
  {a x}0
0
  .k
$ rlwrap -n ./k
K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems 
\ for help. \\ to exit.

  {a}0

  .k
.,(`a;;)
$ rlwrap -n ./k
K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems 
\ for help. \\ to exit.

  {a x}0
0

  .k
.,(`a;;)

Note, that k2.8 does not add "a" to the k-tree in either of these cases

$ rlwrap -n ./k
K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems
Evaluation. Not for commercial use. 
\ for help. \\ to exit.

  {a:2}0
  {a:2; x}0
0

  .k

So ... the addition to the k-tree when "a" is "null" seems to be an error in implementation.